How can my app find the sender of a windows message?

后端 未结 3 1900
無奈伤痛
無奈伤痛 2020-12-03 17:23

I have an app which uses a keyboard hook procedure in a library. The wParam in the hook for one message is 255 which we think is \"(reserved / OEMClear)\". I\'d like to work

相关标签:
3条回答
  • 2020-12-03 17:44

    There is no built-in way to find out who sent the window message, not even win32k keeps track of this; you might be able to find it out with a kernel debugger and a conditional breakpoint.

    However, I would argue that you don't really need this information; you need to make your app properly handle any message sent to it.

    0 讨论(0)
  • 2020-12-03 17:57

    Im not sure if this does what you want it to but have a look at Process Monitor by sysinternals.

    http:// technet.microsoft.com/en-us/sysinternals/bb896645.aspx

    It shows everything that happens to a process so i assume it catches messages as well. The site was down at time of writing so i couldnt check.

    0 讨论(0)
  • 2020-12-03 18:09

    (I originally suggested using Spy++ or winspector, but they do not hook into the sending of messages. That doesn't even make sense! A window receives messages but they don't send them, a thread does that. I'll leave my suggestion about using a debugger.)

    Sometimes debugging can help. Try downloading the windows PDB files and setting a breakpoint that hits only when one of these messages occur. Looking at the call stack at that point can often shed some light on why things are happening. Posted messages and messages send from other processes will foil this approach.

    0 讨论(0)
提交回复
热议问题