Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test for Shift Key
Message
 
To
26/09/2005 05:47:42
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01052949
Message ID:
01052957
Views:
8
This message has been marked as the solution to the initial question of the thread.
>Hi All. Is it possible to test for just the shift key being held down? Or the Alt key or the Ctrl key - just by themselves?

Test this:
#define VK_SHIFT          0x10
#define VK_CONTROL        0x11
#define VK_MENU           0x12
#define PRESSED           0x07

DECLARE INTEGER GetKeyboardState IN WIN32API STRING @

DO WHILE .t.
   m1 = REPLICATE(CHR(0),255)   
   wait WINDOW "" TIMEOUT 0.5
   GetKeyboardState(@m1)
   ? "Shift",ASC(SUBSTR(m1,VK_SHIFT+1,1)), BITTEST(ASC(SUBSTR(m1,VK_SHIFT+1,1)),PRESSED)
   ? "Control",ASC(SUBSTR(m1,VK_CONTROL+1,1)), BITTEST(ASC(SUBSTR(m1,VK_CONTROL+1,1)),PRESSED)
   ? "Alt",ASC(SUBSTR(m1,VK_MENU+1,1)), BITTEST(ASC(SUBSTR(m1,VK_MENU+1,1)),PRESSED)
   IF LASTKEY() == 27
      EXIT
   ENDIF
ENDDO
      
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform