开发者

How to find who generated a windows message

We 开发者_运维百科have a very large, complex MFC application. For some reason a particular mode for running our application is generating WM_SIZE messages to the window. It should not be happening and is killing performance. I can see the message getting handled. How can I find what or where in the code, is generating the window message?

Note: it tends to happen when we have a performance monitoring tool hooked into the application. So it might be the third party tool doing it.

But it only happens in this one particular mode of operation so it might be some sort of strange interaction.


You could see message map to specify for which all windows onSize has been mapped.

as an 'not elegant' alternative, you could trape WM_ONSIZE in PreTranslateMessage and see windows handle using hwnd member of pMsg structure being passed in PreTranslateMessage.


How would it help to know who sends the message? I would rather focus on a solution, such as delay processing of the message (assuming this processing is responsible for the perf hit) when an avalanche of such messages is detected.

e.g. If you receive too many messages within x milliseconds, you may decide to start a timer and process only the last message receives when the timer elapses. This way, you process max one message per x milli-seconds instead of each one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜