Global hooking to Cwnd::Create using MHook

2019-08-08 12:03发布

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?

标签: c++ mfc hook
1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-08-08 12:14

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.

查看更多
登录 后发表回答