CAPIHook剪贴板对SetClipboardData和GetClipboardData的挂接失败 [英] CAPIHook Clipboard hooking fails for SetClipboardData and GetClipboardData

查看:430
本文介绍了CAPIHook剪贴板对SetClipboardData和GetClipboardData的挂接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用jeffrey richters的示例22 LastMsgBoxInfoLib,将其修改为挂钩User32.dll的SetClipboardData和GetClipboardData函数.但是挂接过程失败.我的想法是以下调用不正确.
g_hhook = SetWindowsHookEx(WH_GETMESSAGE,GetMsgProc,
ModuleFromAddress(LastMsgBoxInfo_HookAllApps),dwThreadId);
我传递给上述SetWindowsHookEx的前两个参数应该是什么,以便可以捕获剪贴板事件并复制粘贴命令?
谢谢
Bikram ...

Hi,
I am using jeffrey richters''s example 22 LastMsgBoxInfoLib, modified to hook User32.dll''s SetClipboardData and GetClipboardData functions. But the hooking process fails. My idea is that the following call is not correct.
g_hhook = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc,
ModuleFromAddress(LastMsgBoxInfo_HookAllApps), dwThreadId);
What should be first two parameters, that I pass to the above mentioned SetWindowsHookEx, so that I can capture clipboard events and copy paste commands?
Thanks
Bikram...

推荐答案

It is clear from http://msdn.microsoft.com/en-us/library/ms644990(v=vs.85).aspx[^]. Your first to parameters are correct, the last two parameter depend on where you want to handle the message, please see explanation of these parameters and remarks. Both parameters of NULL is the most usual use.

You capture WH_GETMESSAGE, and the messages will be filtered by the message IDs in your message hook procedure you''re installing.

—SA


SAKryukov,

我能够使其正常运行,但最终却是一个愚蠢的错误,
我用错误的参数声明了挂钩函数,
(HANDLE hMem,UINT uFormat)而不是
(UINT uFormat,HANDLE hMem).

问候
比克拉姆...
Hi SAKryukov,

I was able to get it working, it was a silly mistake at my end,
I declared the hooking function with wrong parameters,
(HANDLE hMem, UINT uFormat) instead of
(UINT uFormat ,HANDLE hMem).

Regards
Bikram...


这篇关于CAPIHook剪贴板对SetClipboardData和GetClipboardData的挂接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆