Walkthrough of Writing an ActiveX Control

Creating an ActiveX Control is simple using Visual Studio. Whether you're using Visual Basic, C++, or another language, you should be able to start a new ActiveX project using the New Project wizard. After you have created your project, create public functions and methods to perform the desired tasks. Whatever you make public will be available to other programs.

As long as the appropriate interface(s) are properly implemented, any ActiveX control can be easily embedded into any given programming project. Implementors may choose to include, at the most basic level, simply the IUnknown interface if the control has menial tasks to complete. However, depending on the complexity of the ActiveX control to be written, any number of the interfaces listed below may be implemented, at the discretion of the developer.

What are the basic components?

ActiveX Controls, at their simplest, only need to support the IUnknown interface and be self-registering. To provide additional functionality, an ActiveX Control may support additional interfaces. Following is a list of possible interfaces:

IOleObject
IOleInPlaceObject
IOleControl
IdataObject
IViewObject2
IconnectionPointContainer
IProvideClassInfo2
IspecifyPropertyPages
IperPropertyBrowsing
IpersistStream
IpersistStreamInit
IpersistMemory
IpersistStorage
IpersistMoniker
IpersistPropertyBag
IOleCache2
IRunnableObject

For a control to be self-registering, it must implement the DLLRegisterServer and DLLUnregisterServer functions.

For additional information please see Microsoft's documentation.

 

Moon Valley Software