Handling All the Messages In A Dialog
-
24. února 2012 5:38
I have an MFC app. I have list of ATL property sheets which is attached to the view. So the view is basically filled by the ATL Property Sheets. My requirement, there is Automation app which automates my app by Posting messages to the controls in the ATL property sheets . Now I want my automation app to wait till the message is being processed. I'm able hear many poeple claim why not SendMessage instead of PostMessage. I have to use Postmessage only due to few restrictions. So I have planned like this.
1. There will be a mutex object shared by both the client App and Automation app.
2. Before posting message, this object will be created and in non-acquired state.
3. In the client app, before processing the message it will be acquired by my client thread and it will be released once after the message is processed.
4. My Automation app will wait for this object and once it is released by client app, it will proceed further.
But I dont know how to achieve the step3. Because the automation app some times send command messages [ button click, menu click etc ] and some time notification messages like [ tree view selection change, list view change, etc ].
So in my ATL property sheet, I want to have a placeholder where every message can be caught [ command and notification messages ]. I Want to acquire the mutex object here. Similarly there should be a function which is get called once after every message is processed so that I can release the mutex.
Všechny reakce
-
24. února 2012 14:53
Basically you want to use named mutex inside your application .
http://support.microsoft.com/kb/243953
You can perform hooking on your window procedure etc according to your requirement. To me it seems creating different property sheet as a dll will help you to resolve your problem.
Thanks
Rupesh Shukla
- Označen jako odpověď Rob PanModerator 6. března 2012 9:28