COM Object (Server) sends event notification successfully to COM Client
Without:
- ATL
- MFC
How to efficiently get the main thread to wait/sleep (infinitely) until COM Server notifies the COM Client of a particular event?
COM Object (Server) sends event notification successfully to COM Client
Without:
How to efficiently get the main thread to wait/sleep (infinitely) until COM Server notifies the COM Client of a particular event?
With event objects.
The main thread calls CreateEvent() in its initialisation to create an auto-reset event object.
The main thread then enters an event loop in which it calls MsgWaitForMultipleObjects() repeatedly. (here is an example of a message loop.)
And you generally do need to check for window messages, even if the main thread has no GUI.
In the client thread (the one that creates the sink object) call SetEvent() within the sink method, after any necessary state update. This will wake up the main thread.