Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Test for Shift Key
Message
De
26/09/2005 09:15:02
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01052949
Message ID:
01053004
Vues:
19
>>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
>
>
>
Thanks Borislav. That does the trick for me!
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform