I am trying to create a global WH_GETMESSAGE HOOK without DLL,but I can't success. My OS is Win7 32Bit,This is my some code:
SetWindowsHookEx(WH_GETMESSAGE,GetMsgProc,GetModuleHandle(NULL),0);
Please help me if you have any time. :)
I am trying to create a global WH_GETMESSAGE HOOK without DLL,but I can't success. My OS is Win7 32Bit,This is my some code:
SetWindowsHookEx(WH_GETMESSAGE,GetMsgProc,GetModuleHandle(NULL),0);
Please help me if you have any time. :)
It's obvious, the last parameter shouldn't be '0', it should be the thread id of the thread you want to call the function in. You can't pass in null for both the last and next to last parameters. Use GetThreadId() to get the id of the current thread, that's most likely what you want to do.
The previous poster's answer was very useful for you, if you would have read it you would have seen the above yourself.
You need a message loop in the calling thread of SetWindowsHookEx
As documented,
hMod
must be a handle to a DLL. Not an EXE. This is because the DLL will be loaded into all running processes to be hooked, and its code run straight from within those processes.