Yet another try. Of coures i'm not even sure i'm calling RegisterHotKey correctly ;(
#!/usr/bin/perl $| =1; use warnings; use strict; use Data::Dumper; use Win32::GUI; use Win32::API; my $proto = 'BOOL RegisterHotKey(HWND hWnd, int id, UINT fsModifiers, +UINT vk)'; Win32::API->Import('user32', $proto) or die "import RegisterHotKey: $! + ($^W)"; my $mw_win32 = new Win32::GUI::Window( -title => 'This is a test!', -width => 100, -height => 100, -name => 'MainWindow'); $mw_win32->Show(); # Call: my $ret = RegisterHotKey ($mw_win32->{-handle}, 10, 11 , 41); if (not $ret) { die "RegisterHotKey: $! ($^E)"; } print "Return: $ret\n"; $mw_win32->Hook( 273, sub {print "TEST"}); while (1) { Win32::GUI::DoEvents(); my $x = [$mw_win32->PeekMessage()]; print Dumper($x) if @$x > 1; }
This still doesn't work, in fact the PeekMessage's doesn't appear to do anything at all! And the hook never fires either.
In reply to Re: Windows Hotkey
by eric256
in thread Windows Hotkey
by eric256
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |