AsmCtrl - An Active-X Control written in Assembly
A. About
AsmCtrl is a fully functional, embeddable Active-X control written in assembly (Masm syntax).
Usually, such controls were written in C/C++, with the help of MFC or ATL.
AsmCtrl uses no help from external libraries, so it's a nice example of how
pure COM looks like.
B. Screenshots
If AsmCtrl is inserted into a container application, it looks like this (displayed with COMView):
The "data" which AsmCtrl does "manage" are the values returned by
the CPUID instruction with calling parameter EAX=0 - the "vendor" and
the highest basic calling parameter.
AsmCtrl also exposes a few properties and methods (displayed with COMView) through its IAsmCtrl automation interface:
C. COM Interfaces supported by AsmCtrl
To be fully functional, a lot of COM interfaces have to be supported:
- IOleObject: this "interface is the principal means by which an
embedded object provides basic functionality to, and communicates with, its container."
- IOleInPlaceObject: this interface "manages the activation and
deactivation of in-place objects, and determines how much of the in-place object should be visible."
- IOleInPlaceActiveObject: this interface
"provides a direct channel of communication between an in-place object and
the associated application's outer-most frame window and the document window
within the application that contains the embedded object."
- IPersistStorage / IPersistStreamInit: to allow an object to save its state, it has
to support either IPersistStorage or IPersistStreamInit or both.
- IDispatch: if the objects is to support Automation and have
some private methods or properties, this interface is needed.
- IConnectionPointContainer: if the object is to support events,
this interface and its companions IEnumConnectionPoints, IConnectionPoints and
IEnumConnections are required.
For bureaucracy reasons, the following are also "must haves":
- IClassFactory: to be able to "create" the object.
- IUnknown: guess
Quite a few interfaces are optional. AsmCtrl supports the most important ones:
- IDataObject: "Enables data transfer and notification of changes in data. "
- IViewObject: "Enables an object to display itself directly without passing a data object to the caller."
- IOleControl: "Provides the features for supporting keyboard
mnemonics, ambient properties, and events in control objects."
- IPersistPropertyBag: defines an individual property-based persistence mechanism.
- IProvideClassInfo: "Provides access to the type information for an object's coclass entry in its type library."
- ISpecifyPropertyPages: "Indicates an object supports property pages and retrieves those pages."
- ICategorizeProperties: to make it look nicer during development.
- IRunnableObject: "Enables a container to control the running of its embedded objects."
D. AsmCtrl Source Code
E. Download AsmCtrl
|
|