From: Steve Pick <steve@ba...> - 2003-12-05 03:27:50
In this episode:
Hook(handle, msg, sub); or $win->Hook(msg, sub);
Allows you to say "whenever the window receives this msg id, call the given
subroutine with the msg's wParam and lParam as arguments".
This basically infinitely expands the NEM to encapsulate any event you want.
The sub given needs to be a coderef, otherwise it just won't register your
hook. The msg must be a number (not a freakin' string, for all those users
who dont know the difference between a constant and a bareword-string). If
you want to re-define the hook, err, call it again. This will probably cause
a memory leak, since it doesnt decrement the refcount when you re-assign the
AV, but hey, that'll be fixed soon (oops.).
UnHook(handle,msg); or $win->UnHook(msg);
Removes the hook for the given msg.
Please experiment with this, be ready for crashes. I've not got it to
explode yet, but it's worth heavilly testing.