开发者

How do I get mouse WM_MouseMove Message on SCREEN?

Now I'm working on a project which require me开发者_高级运维 to get mouse moving message from all time. My app only have a tiny windows for configuration purpose and it will not even appear on the desktop for most of the time. What I need is I need to be able to record mouse moving on desktop. meaning people moving their mouse on the desktop (which should be explorer.exe ,right?) and I need to know.

How do I do that? Using c# or C++. using inject? Global hook? I heard that only c++ supports global hook, right?


Yes, you need a global hook, and as far as I know you should use C or C++.

See the docs about function SetWindowsHookEx() & co. (WH_MOUSE hook).

But beware! You must write a global hook in a DLL, and it will get injected in every process with a window, so any bad thing you do will likely crash any other program in your session (including explorer.exe, devenv.exe, etc.).


You can also use SetCapture. Although it's capabilities are limited compared to a hook, check it out.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜