寻找32/64位WM_MOVING全局钩子源C ++示例。 [英] Looking for a 32/64 bit WM_MOVING global hook source C++ sample.
问题描述
你好,
我正在寻找一个源样本来检测x86 / x64 windows系统中的任何窗口移动(因此,一个全局钩子)。 />
我搜索了一下,但我发现全局挂钩的所有内容都以键盘/鼠标样本结束。
我检查了 MinHook项目,它带有不同类型的键盘样本,但当我试图调整它以检测任何WM_MOVING(MoveWindow)事件,我无法使其工作。
更新:我终于设法挂钩窗口移动事件(挂钩Windows'API DefWindowProcW
,事件编号WM_MOVING = 0x0216)。
问题是MinHook只能在我自己的应用程序事件本地工作,而不是我想要的全局。
我看的原因对于一个样本是因为我不是C ++专家,正在寻找某种样本来看看。
提前谢谢。
本文提供了一些有关创建加载到每个应用程序的地址空间的DLL的有用信息。这篇文章有点过时了,关于创建共享内存部分的建议不适用于Windows Vista及更高版本。
钩子和DLL [ ^ ]
关键是 - 我认为 - WH_GETMESSAGE钩子机制。它将为GetMessage返回所有Windows消息。
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644959%28v=vs.85%29.aspx [ ^ ]
Hello,
I'm looking for a source sample to detect any window move (thus, a global hook) in x86/x64 windows systems.
I've searched a bit but all I found about global hooks end in keyboard/mouse samples.
I've checked the MinHook project which comes with different type of keyboard samples but when I tried to adapt it to detect any WM_MOVING (MoveWindow) event, I wasn't able to make it work.
UPDATE: I finally managed to hook the window move event (hooking the Windows'API DefWindowProcW
with event number WM_MOVING = 0x0216).
The problem is that MinHook only works locally on the own app's events and not globally as I was intending.
The reason I was looking for a sample is because I am not a C++ expert and was looking for some sort of sample to ahve a look.
Thank you in advance.
This article has some useful information on creating a DLL that loads into each applications's address space. The article is a bit dated in that the advice on creating a shared section of memory doesn't work with Windows Vista and later.
Hooks and DLLs[^]
The key is - I think - the WH_GETMESSAGE hook mechanism. It will give all windows messages returned by GetMessage.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644959%28v=vs.85%29.aspx[^]
这篇关于寻找32/64位WM_MOVING全局钩子源C ++示例。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!