Hi guys,
i have code running in a dll. It is necessary for me to redirect the WndProc of a window so that i can catch certain messages. When i make the call to SetWindowLong(), i get back the address to the old (original) wndProc, which i save.

The trouble is, how do i get the old wndproc to do default processing of messages when i receive control? As there is only two messages that i am interested in, how should i exit the new wndProc, as i have already done the default processing? Is it correct to do the default processing as soon as execution enters the new wndProc, as i want my handling to be the last in the chain?. Here is what i am doing now:



newWndProc proc hWnd :HWND, uMsg :MSG, wParam :WPARAM, lParam :LPARAM
;do default process of this message first:
push lParam
push wParam
push uMsg
push hWnd
mov eax, oldWndProc
call dword ptr [eax]

;now intercept my messages:
.IF uMsg == WM_CTLCOLORBUTTON
...code...
...code...
.ELSE
??? what should i put here?
.ENDIF

xor eax, eax ;} are these 2 lines necessary?
ret ;}
newWndProc endp


Thanks! :alright:
Posted on 2001-12-19 20:56:18 by sluggy
Hi,

Check example program TDITB from masm32 v7 package. It does exactly this.

I don't remember how I did it and I'm not currently on computer where masm is installed so I can't check it for you.

If you don't have masm32 v7, post reply, and I'll check it when I'm at my home computer.

Sami
Posted on 2001-12-20 12:23:01 by SamiP
Hi Sami,
after checking the tuts on Icz's site, i have decided that i have been going in slightly the wrong direction, what i need to do is a straight job of subclassing the parent window, not superclassing. I will scream out if i have any further problems :)
Posted on 2001-12-20 14:48:15 by sluggy