开发者

I want to monitor global mouse event, how to do it by using MFC?

开发者 https://www.devze.com 2023-01-07 18:58 出处:网络
I want to write a program: click a window(some other program, like firefox, explorer..) get this window\'s HWND

I want to write a program:

  • click a window(some other program, like firefox, explorer..)
  • get this window's HWND
  • do something to that win开发者_开发技巧dow

My method is using PeekMessage to get event, but looks like PeekMessage only peek the message send from my program.

So how can I add a hook to all the other windows, or monitor global events?


SetWindowsHookEx, with the WH_MOUSE or possibly WH_MOUSE_LL flag. MFC itself doesn't really have much to do with this, at least to my recollection (though, behind the scenes, MFC can/does install a hook, or maybe even more than one, itself).

0

精彩评论

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