-
Intercepting messages
Is it possible to intercept to messages that belong to other processes? Both GetMessage and PeekMessage have the capability to get messages from other handles (this is in reference to the second parameter). I was able to get another program's handle (Minesweeper) using FindWindow and use it in PeekMessage and GetMessage, however neither of them were picking up any messages. Then I tried opening the program up with "PROCESS_ALL_ACCESS" privileges for OpenProcess, then using that handle. Neither of these methods worked, so I am wondering, is there any way to get messages that belong to other processes? Maybe a rundll32 injection or CreateRemoteThread method?
-
GetMessage() and PeekMessage() can only get messages for windows they own.
-
You can set a windows message hook with SetWindowsHookEx. Specifically, you will be interested in WH_CALLWNDPROC and WH_GETMESSAGE. To hook messages belonging to other processes, the hook procedure must be in a DLL. You can search the board and the web for examples.