Using ActiveX Controls
The topics in this section present an overview of using ActiveX controls.
An ActiveX control is a COM component that supports standard interfaces relating to persistence, connection points, and hosting. These standard interfaces define a protocol by which a control can be hosted in a control container, exchange messages, and handle events.
As COM servers, ActiveX controls have the following.
Controls have member variables to represent internal state and are implemented as Get and Set accessor functions. A Get function is generated for each accessor method with a propget tag in the .idl file. A Set function is generated for each accessor method with either a propput or propputref IDL tag.
A control's behavior is defined by its public methods. Wrapper classes give you access to a control's methods.
If you do not use wrapper classes (the default), you get access to a control's methods by obtaining a pointer to an interface.
An example of a public method is the Refresh method in the ADO data control, which updates the retrieved rowset.
A control can generate an event to notify the host that something happened. An example is the OnClick event for the Button control. When the button gets clicked, the button generates an OnClick event. If the control's host has a handler for that event, it executes.
A type library tells a control container what properties, methods, and events are supported by a control. Type libraries can exist either as separate files (with a .tlb extension) or internally within the control.
Type libraries also contain the control's coclass information. A coclass is a COM class that is identified with a GUID. A coclass contains one or more interfaces that are defined by the control.
To examine type libraries, use the OLE/COM Object Viewer.
The following topics describe the use of an ActiveX control: