Dave's Brain

Browse - programming tips - windows control without the hassle of installing in registry

Date: 2010jan13
OS: Windows

Q. I want to use a Windows control in my application but don't want the
hassle of installing in the registry that an OLE / ActiveX control requires.
What can I do?

A.  A custom common control may work for you.
With this type of control in your resource (.rc) file like this:

	CONTROL "", IDC_MY_CONTROL, "MyControl", WS_CHILD | WS_VISIBLE, 10, 10, 100, 100

Then in your code before you create the dialog you need to instantiate
a class called "MyControl" with RegisterClass().
Use UnregisterClass() when you control is no longer needed.
You class has to have a procedure that implements your control.

Your control can live in the same EXE (or DLL) as your dialog code.

This is a very nice lightweight way to make a control.

There are lots of tutorials
http://www.google.com/search?q=custom+common+control
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2010, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.