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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.
And read this and this, if you haven’t already.