|
-
April 13th, 1999, 12:26 AM
#1
Dynamic Event Handlers
Hi all :
How do you dynamically create an event handler for a COM object ? Specifically, I need to create a vtable dynamically so that it implements dual interface (event) described by the type library of the COM server. This is much like what VB does when it generates a skeleton event handler for any arbitrary COM object.
Any help is greatly appreciated.
Regards,
Amitava
CA-TCG Software Pvt. Ltd.
-
April 16th, 1999, 03:07 AM
#2
Re: Dynamic Event Handlers
See IConnectionPoint::Advise, Unadvise. Ask target for IConnectionPointContainer, find your event, and then Advise. Don't forget to Undavise.
Sincerely, Mihai
-
April 16th, 1999, 06:34 AM
#3
Re: Dynamic Event Handlers
Hi Mihai :
I was actually referring to runtime synthesis of a vtable so that I could create a sink implementation on the fly.
Let's say I discover (at runtime) that CLSID_XX has an event interface IID_ISomething & it is defined as follows :
interface ISomething : IDispatch
{
HRESULT OnSomething();
}
However, I've no way of having a pre-defined ISomething implementation. I could ofcourse have a generic IDispatch implementation. However, for the connection point to work, this implementation must succeed when IID_ISomething is queried for .
IConnectionPoint::Advise() queries for the interface it represents. But then I am breaking the contract that ISomething promised namely that of supporting OnSomething() as a valid vtable entry. Ofcourse, if the server never calls through the vtable and always uses IDispatch::Invoke() instead, everything is kosher.
I know VB does that. The question is how ?
Regards,
Amitava
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|