Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create an ActiveX control out of a Windows control? 1

Status
Not open for further replies.

apostolchopov

Programmer
Jun 8, 2004
53
BG
Hello, fellows!
Could you, please, tell me how to create an ActiveX control out of an existing Windows control (for instance a tree control)?

Thank you for your cooperation!

Regards!
 
Programs use ActiveX controls through automation interfaces exposed by the controls. Programs use Windows controls through messages posted to the control's message queue.

So in order to make an ActiveX control from a Windows control, just create an ActiveX control class with an automation interface that has a method for every message the Windows control is designed to handle (and that is not already covered by whatever toolkit, such as ATL, that you use to make your ActiveX control). In the methods of the ActiveX control that create a new instance, just create the corresponding Windows control and hold onto the handle of the new window for use in the other methods you created for the ActiveX control.

If you want to make a really simplistic but crude ActiveX wrapper for a Windows control, just have one method in your automation interface - PostMessage. Make it have the same arguments as the PostMessage function in the normal Windows API. The implementation of this would just forward its parameters on to the Windows control inside (through the windows handle you hold onto after creating the Windows control).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top