I'm a Linux programmer and new to COM programming and I've inherited a program which I'm now trying to modify. I've got an IDL file with the following dispinterface and I'm trying to set up a callback in C++. I've been searching the web and I've found some stuff with connection points, but I don't see a simple example that I can follow, so I was wondering someone could help me out.
The dispinterface:
[
helpstring("Event interface"),
helpcontext(0x00000006)
]
dispinterface _DEvents {
properties:
methods:
[id(0x00000001), helpstring("Occurs when about to begin."), helpcontext(0x0000000d)]
void Starting();
[id(0x00000002), helpstring("Occurs at the beginning."), helpcontext(0x00000011)]
void Begin();
[id(0x00000003), helpstring("Occurs at the end."), helpcontext(0x00000012)]
void End();
};
The coclass:
[
helpstring("C Class"),
helpcontext(0x0000009e)
]
coclass C {
[default] interface IE;
[default, source] dispinterface _DEvents;
};
The sink interface:
[
odl
]
interface INotifySink : IUnknown {
HRESULT _stdcall Starting();
HRESULT _stdcall Begin();
HRESULT _stdcall End();
};
I've found these two articles, but I can't make heads or tails of them:
- http://www.codeproject.com/KB/COM/TEventHandler.aspx
- http://www.codeproject.com/KB/COM/com_in_c5.aspx
I imagine I have to make a new class that extends INotifySink, and implements the functions, but then what do I do after that?
Thanks, Jayen
P.S. Let me know if I need to provide more information and I'll edit this question. Thanks.