3.4.2 A simple implementation of a single Automation interface
In the case where you are implementing a single
dispinterface that was designed by someone else, for example an event sink, you can usually avoid needing to parse a type library or define a class to implement the interface.
Instead, you implement a dispinterface using the class simple-i-dispatch by doing the following:
Obtain an interface pointer that will provide type information for the component, to be used as the
argument in the call to the function query-simple-i-dispatch-interface. In the case where you are implementing an event sink, the source interface pointer will usually do this.
Optionally, define a class with
inheriting from simple-i-dispatch. The class simple-i-dispatch can be used itself if no special callback object is required.
that selects and implements the methods of the interface.
Define initialization code which calls co-initialize, obtains the
from step 1, makes an instance of the COM object class defined in step 2 with the
from step 3, obtains its interface pointer by calling query-simple-i-dispatch-interface (passing the
) and attaches this interface pointer to the appropriate sink in the
(for example using connection point functions such as interface-connect). This must all be done in a thread that will be processing Windows messages (for instance a CAPI thread).
LispWorks COM/Automation User Guide and Reference Manual - 21 Feb 2008