Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Test for Shift Key
Message
 
À
26/09/2005 05:47:42
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:
01052957
Vues:
10
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform