Link to home
Start Free TrialLog in
Avatar of MichaelMaromm
MichaelMaromm

asked on

Connection points - advise question

Hi,

I want to make advise for a connection point in my MFC application.
I need an IUnknown pointer of the sink, to pass it as an argument for 'advise' method.

My question is, how to get this pointer ?

Thanks
Michael
Avatar of ekc
ekc

The sink interface belongs to a client side of the event-mechanism, to an object you need to create and manage in your client code.
Tipicaly, you will create an object on the client side which will implement the same interface as the one in the connection point object you want to connect to. Then you will create the instance of this object (now you have the pointer), and pass its IUnknown to Advise function...
ASKER CERTIFIED SOLUTION
Avatar of pcj0961
pcj0961

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MichaelMaromm

ASKER

Hi pcj0961,

Thanks for your answer,

The compiler want the IDispatch implementation at the interface map :

BEGIN_INTERFACE_MAP(CMainFrame, CFrameWnd)
   INTERFACE_PART(CMainFrame, DIID__IHVACEvents, HVACEvents)
END_INTERFACE_MAP()


How can I add the IDispatch implementation to my MFC sink ?

Thanks
Michael.