


|
Personal page of Konjengbam |
|
“Bluetooth adopter, technology enabler and innovative thinking” |

Sample example on ATL COM event source-sink interactionTo demonstrate the use of COM callback interfaces (commonly known as the sink interfaces), we take the example of a simple source and sink implementation using ATL wizard. Note that these implementations also support MFC. For event handling, it may worthwhile to remember that source interfaces inherited from IDispatch causes COM Clients to implement the same interface (as sink objects) with all the usual nitty-gritty methods of IDispatch. Inheritance from IDispatch makes the implementation compatible with scripting environments or OLE automations.
In the ensuing example, we present an IDL file that demonstrates elementary service advertisements. In the IDL below, ITick represents the main co-class' service interface and _ITickEvents is the source interface for event handling. |
|
Fig.A1 - IDL file for Tick object
Given this IDL, we then proceed to implement the Tick object. Using ATL wizard the Tick server implementation continues as follows: |
|
>> Contd. next page |