API equivalent of SetWindowCallback?

Everything else that doesn't fall into one of the other PB categories.
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

API equivalent of SetWindowCallback?

Post 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.
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Re: API equivalent of SetWindowCallback?

Post by Doobrey »

OldProc.l=SetWindowLong_(hwnd,#GWL_WNDPROC,@MyCallbackProc())
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: API equivalent of SetWindowCallback?

Post by traumatic »

Code: Select all

SetWindowLong_(hWnd, #GWL_WNDPROC, @YourProcHere())
EDIT: Why, oh why am I always too late!?!?!? :evil:
Good programmers don't comment their code. It was hard to write, should be hard to read.
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Re: API equivalent of SetWindowCallback?

Post 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.
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: API equivalent of SetWindowCallback?

Post 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 ? ;)
Good programmers don't comment their code. It was hard to write, should be hard to read.
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Post 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.
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Hm, I'll have to try SetWindowClass too.
Post Reply