On 24/09/2007, Veli-Pekka Tätilä <[EMAIL PROTECTED]> wrote:
> Robert May wrote:
>>> Has anyone gotten the system wide RegisterHotkey and  UnrEgister hotkey
>>> Win32 functions working with Win32::GUI and Win32::API?
>> See here:
>> http://www.mail-archive.com/[EMAIL PROTECTED]/msg05248.html
>
> Now the only big question is what was the difference to my code?
> the only major differences I can see is at a gllance, with a screen
> reader, are as follows:

[snip]

> Last but not least, you use a nice constant like:
>
>  VK_A
>
>  Where I use the ASCII value
>
> ord 'q'
>
> since I read in Petzold that the virtual key codes for letters are the
> ASCII codes for those letters. Does the case matter normally or since
> shift is down?
>
> ord 'Q'; # is obviously quite different from the lowercase q.

This is the difference.  The virtual key code for a key does not
change when the shift key is down.  It's the combination of seeing the
virtual key code for the shift key and a letter key that allows
TranslateMessage convert virtual key codes in WM_KEYDOWN/WM_KEYUP
messages to the WM_CHAR messages containing the 'character' to be
used.

The virtual key codes for the letter keys are (on an English keyboard)
the ASCII codes for the UPPER case letters.

> Here are the significant snippets from my original:

[snip]

> RegisterHotKey
> (
>    $win->{'-handle'}, HOTKEY_ID,
>    MOD_SHIFT | MOD_CONTROL,
>    ord 'q'
> ) or die "HOtkey registration failed: $^E\n";

I think if you use ord 'Q' rather than ord 'q' your code would work (untested).

Regards,
Rob.
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to