Jump to content
Tuts 4 You

Catching remote WM_PAINT messages


kolynet

Recommended Posts

hi all,

 

i would like to ask ur help if you can guide me on how to subclass/detour remote (exe) control or simply catch remote process's wm paint messages using hook or whatsoever?

 

preferred language delphi. would likely pay $$ for help. ty!

Link to comment

You will want to hook their WNDPROC to obtain the window messages. This can be done using the SetWindowLongPtr API.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms644898(v=vs.85).aspx

For compatibility reasons and for privilige reasons its typically best to do this via DLL injection so you can hook into the same process, but it is not required. (On XP/2000 though, as MSDN says if you do not own the window, the API call will fail.)

You will need the windows hWnd for this, which you can obtain via FindWindow or enumerate the windows via EnumWindows:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms633497(v=vs.85).aspx

Once you have the hWnd of the window you want to subclass, use SetWindowLongPtr with the GWL_WNDPROC param. The last param will be a pointer to the new function to call. (Be sure to store the return and use it for returning default values back to the window so it does not lock up or work incorrectly.)

Edit: Here are some direct examples for Delphi:

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_20026950.html

http://swag.outpostbbs.net/DELPHI/0041.PAS.html

http://stackoverflow.com/questions/24533123/how-to-get-the-window-handle-from-inside-wndproc

Edited by atom0s
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...