Page 1 of 1

API equivalent of SetWindowCallback?

Posted: Thu Feb 17, 2005 3:05 am
by dracflamloc
What is the API equivalent of SetWindowCallback?

I would like to do some more advanced callback stuff, can't seem to find it's equivalent in the Win32 API docs.

Re: API equivalent of SetWindowCallback?

Posted: Thu Feb 17, 2005 3:17 am
by Doobrey
OldProc.l=SetWindowLong_(hwnd,#GWL_WNDPROC,@MyCallbackProc())

Re: API equivalent of SetWindowCallback?

Posted: Thu Feb 17, 2005 3:21 am
by traumatic

Code: Select all

SetWindowLong_(hWnd, #GWL_WNDPROC, @YourProcHere())
EDIT: Why, oh why am I always too late!?!?!? :evil:

Re: API equivalent of SetWindowCallback?

Posted: Thu Feb 17, 2005 3:38 am
by Doobrey
@traumatic
Just type faster!

... anyway, we both forgot to say that you should add

Code: Select all

 ProcedureReturn CallWindowProc_(OldProc,hwnd,message,wParam,lParam)
for anything your callback doesn`t handle.

Re: API equivalent of SetWindowCallback?

Posted: Thu Feb 17, 2005 1:49 pm
by traumatic
Doobrey wrote:Just type faster!
I guess I should simply start being more self-confident and stop using 'preview' that often :)

Code: Select all

 ProcedureReturn CallWindowProc_(OldProc,hwnd,message,wParam,lParam)
What about

Code: Select all

ProcedureReturn DefWindowProc_(hWnd, msg, wParam, lParam)
alternatively ? ;)

Posted: Thu Feb 17, 2005 2:35 pm
by Edwin Knoppert
SetWindowCallback() is not equal to the hook described here (afaik).
I believe SetWindowCallback() is resetting the windowclass procedure.
So all windows with the same class will 'suffer'.

The hook described above failed when i tried this in earlier PB versions.
Hopefully something has changed and will let us use hooks.

Posted: Thu Feb 17, 2005 8:58 pm
by dracflamloc
Hm, I'll have to try SetWindowClass too.