Global hooking to Cwnd::Create using MHook

陌路散爱 提交于 2019-12-24 12:27:45

问题


I have been trying to hook to CWnd::Create method. I tried to hook using SetWindowsHookEx api. But this is not working consistently. So, I have followed the following blog http://www.codeproject.com/Articles/49319/Easy-way-to-set-up-global-API-hooks and tried to hook to CreateWindowEx api.

Here, I am not sure whether CreateWindowEx will be called from Cwnd::Create API.

Can we hook to Cwnd::Create procedure using MHOOK? If so hooking to CreatWindowEx is the right api to listen to Cwnd::Create calls?


回答1:


Please go through this link http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/e71f690a-00de-4032-95e2-21660e2235f6/setwindowshookex-on-windows-7

Not all keyboard and mouse hooks are marshalled, only globals. And marshaling of hook is performed by thread message queue. So, thread that installs hook MUST call message pumping method.



来源:https://stackoverflow.com/questions/18246601/global-hooking-to-cwndcreate-using-mhook

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!