Hello,
Here's a nice idea:
use Win32::GUI;
my $win = new Win32::GUI::Window(
-name => "Test",
-left => 100,
-top => 100,
-width => 100,
-height => 100,
-onResize => \&Test_resize
);
# Whenever we get WM_SETCURSOR, call perl sub setcursor with message
parameters.
$win->Hook(WM_SETCURSOR, \&setcursor);
# ... some code ...
# Reassign WM_SETCURSOR to go elsewhere
$win->Hook(WM_SETCURSOR, \&changecursorback);
# ... some more code ...
# Now reset WM_SETCURSOR to trigger DefWndProc().
$win->UnHook(WM_SETCURSOR);
Since we can never implement all the events the user might wish to catch in
the NEM, this method lets the user define when they want to catch a specific
event and handle it in Perl, and when they want to finish their capture.
This beats the hell out of using GetMessage (non-blocking, faster, simpler)
and PeekMessage (peekmessage always seems to return nothing anyway).
What do you think? Should I implement this?
Steve.