I am debugging GUI app on windows and I want to find out who is the sender of some message. On linux, I can run app in synchronized mode and find the sender in call stack. Is there any equivalent mode in windows?
Share
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.
AFAIK there’s no built-in ability to do this.
But let’s first investigate the problem. You want to know who’s the sender of the message. You should know however that windows message processing can be classified by the following criterias:
PostMessagevsSendMessage).You may trace directly the sender only when the message is sent (not posted) to a window, whereas the call to the
SendMessage(or similar) was issued in the thread to which the window belongs. In such you will see the sender in the call stack.In case the message was sent from another thread – you will not see it in the call stack. Simply because the call stack shows the call chain that belongs to the current thread only. When a message is sent from another thread the system performs the following:
GetMessage(or similar) – the message is dispatched to the window.SendMessagereturns with the result that was returned by the window procedure.In such a case you may try to identify the caller indirectly. Interrupt your program with the breakpoint, and try to search for suspended threads, which are blocked in a call to
SendMessageor similar.Finally, messages that are posted are impossible to trace by the above method. You may try to put a conditional breakpoint on a call to
PostMessage, but if the caller belongs to another problem – this will be more complex.