WINAPI: see messages from another process

I am new to the Windows API and would like to know how to look at messages received by another process. For example, I would like to get an HWND, say, a notepad and look at all the messages that are sent to this window. I am code in C / C ++.

thanks

+4
source share
3 answers

You can use SetWindowsHookEx , with WH_CALLWNDPROC or some other type, but here is an example.

WH_CBT can give you great opportunities, because you can get the code HCBT_CREATEWND from it, and it is sent to you right before creating the window, which gives you the opportunity to provide your own proc window instead of the real one, and then you can get all the messages with it.

Remember that great opportunities also mean great responsibility. Say that you โ€œsubclassedโ€ some window by providing your proc window if your application that sets the hook exits, the next thing you will see is the application whose messages you looked in will work if you did not specify the address the original proc window back to where it belongs. The advantage of this type of interception is the ability to wait for a specific window (say, with a specific window class or name) that will be created and enter this process before any window that interests you is even created.

+7
source

Do you want to see SetWindowsHookEx

+1
source

You are looking for Windows Hooks.

http://msdn.microsoft.com/en-us/library/ms997537.aspx

You can block SendMessage in the target process using the CallWndProc binding procedure .

+1
source

All Articles