Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Workaround for ambiguous values in Keypress Event?
Message
From
11/10/2001 15:26:10
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
 
 
To
11/10/2001 12:41:03
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00567078
Message ID:
00567180
Views:
26
This message has been marked as the solution to the initial question of the thread.
Check out the GetAsyncKeyState() Windows API function.

Use it in your .KeyPress() event to test the state of individual keys; eg.
DECLARE SHORT GetAsyncKeyState IN USER32.DLL ;
   INTEGER vKey

#define VK_SHIFT          0x10
#define VK_F2             0x71

IF  BITTEST( GetAsyncKeyState( VK_SHIFT ), 31 ) = .T. ;
AND BITTEST( GetAsyncKeyState( VK_F2    ), 31 ) = .T.
   ...
ENDIF
>I use the Keypress Event to detect the keystrokes Shift-F2 through Shift-F7. Because these keys have identical values to the keys Shift-U through Shift-Z (85-90) I cannot tell the difference. The effect of this is that on some forms when the operator presses Shift-U (for example) nothing happens.
>
>Capslock and then "u" will result in a capital "U" however because the Keypress Event detects this as a non-shifted character.
>
>Is there a workaround that will reliably detect the difference between Shift-F2 and Shift-U, etc?
>
>TIA
>
>Peter Robinson
Previous
Reply
Map
View

Click here to load this message in the networking platform