How do I intercept messages being sent to a window?

后端 未结 2 390
失恋的感觉
失恋的感觉 2020-12-14 22:54

I want to intercept messages that are being sent to a window in a different process. What is the best way to do this? I can\'t see the messages when I use the WH_GETMESSAGE

2条回答
  •  攒了一身酷
    2020-12-14 23:32

    You need to inject your own code into the process that owns the windows you wish to intercept messages from. Fortunately, SetWindowsHookEx() makes this fairly easy, although you may have a bit of trouble at first if you've only used it for in-process hooking up to now.

    I can recommend two excellent articles on the subject:

    1. Joseph Newcomber's Hooks and DLLs
    2. Robert Kuster's Three Ways to Inject Your Code into Another Process

提交回复
热议问题