SetWindowsHookEx 问题的文档
我不太明白 SetWindowsHookEx()
的文档。我知道在第一个参数中应该输入什么,但对于第二个、第三个和第四个我很困惑。
第二个参数询问 HOOKPROC 是否像常规 Windows 进程一样?
对于第三个和第四个我不明白。那么你们能为我解释一下吗?谢谢
I don't really understand the documentation of SetWindowsHookEx()
. I know what to put in the first argument, but for the second, third and fourth i'm confused.
Second argument askes HOOKPROC is that just like a regular windows proc?
For third and fourth i don't get them. So can you guys explain them for me? thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Windows API 文档比这里的任何人都更好地解释了所有参数: http://msdn.microsoft.com/en-us/library/ms644990(v=vs.85).aspx
第二个 参数是 NULL 或指向 HOOKPROC 的指针。请注意,“如果 dwThreadId 参数为零或指定由不同进程创建的线程的标识符,则 lpfn 参数必须指向 DLL 中的钩子过程。否则,lpfn 可以指向与 DLL 关联的代码中的钩子过程。当前进程。”下面是来自 MSDN 的 HOOKPROC 示例:
如果 dwThreadId 参数指定由当前进程创建的线程并且钩子过程位于与当前进程关联的代码内,则第三参数必须“设置为 NULL”
第四个是“与钩子过程关联的线程的标识符。如果此参数为零,则挂钩过程与与调用线程在同一桌面中运行的所有现有线程相关联。”
The Windows API documentation explains all the arguments better than anyone here can: http://msdn.microsoft.com/en-us/library/ms644990(v=vs.85).aspx
The second argument is either NULL or a pointer to an HOOKPROC. Note that "If the dwThreadId parameter is zero or specifies the identifier of a thread created by a different process, the lpfn parameter must point to a hook procedure in a DLL. Otherwise, lpfn can point to a hook procedure in the code associated with the current process." Here is an example HOOKPROC from MSDN:
The third argument must be "set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.
The fourth is "The identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread."