Problem when subclassing a remote Window

c++ / delphi package - dll injection and api hooking
Post Reply
Mazinger
Posts: 33
Joined: Wed Jan 26, 2005 6:26 am

Problem when subclassing a remote Window

Post by Mazinger »

Hi,

I need to paint my own background on a remote process MDIClient Window.

I'm using Madcodehook to inject my DLL to remote process, and within it, hooking the CreateWindow API to know when the MDClient window is created. On the my hooking CreateWindow function, just after the original CreateWindow is called, I subclass the MDIClient Window, with my own wndProc (thanks iconic for your code sample on this forum, I'm doing the same).

All works fine, but my subclassed wndProc don't receive WM_PAINT and WM_ERASEBKGND messages. Other messages are received (WM_MOVE, VM_SIZE ...)

If I monitor this window with Microsoft Spy++, I see the messages arriving to the window.

Any help will be apprecied to know what's happening.

Thanks in advance.
Mazinger
Posts: 33
Joined: Wed Jan 26, 2005 6:26 am

Post by Mazinger »

Ok, I see the problem: The remote window was subclassed by the remote process too, so I've needed to hook SetWindowLong to know when the remote process subclassed the window. After that, I can receive all messages to the windows.

Extrange?

Thanks!
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Funny! :)
Post Reply