Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Test for Shift Key
Message
De
26/09/2005 10:05:11
 
 
À
26/09/2005 09:57: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:
01053031
Vues:
9
>>>>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?
>>>
>>>Want you the state or the notification of the event ?
>>
>>Hi Fabio. I would like to know if it is depressed or not ie. state.
>
>Jos, you choose what you like more GetKeyState or GetAsyncKeyState
>
>DECLARE SHORT GetKeyState IN WIN32API INTEGER
>#define VK_SHIFT    0x10
>#define VK_CONTROL  0x11
>
>CLEAR TYPEAHEAD
>WAIT WINDOW "NOW TEST GetKeyState" TIMEOUT 5
>x=null
>FOR k=1 TO 50
>	DOEVENTS FORCE
>	newX=GetKeyState( VK_SHIFT ) < 0
>	IF m.newX = m.x
>		LOOP
>	ENDIF
>	x=m.newX
>	WAIT WINDOW IIF(m.x,"you enter with down","you enter with up") NOWAIT NOCLEAR
>NEXT
>
>CLEAR TYPEAHEAD
>WAIT WINDOW "NOW TEST GetAsyncKeyState" TIMEOUT 5
>
>DECLARE SHORT GetAsyncKeyState IN WIN32API INTEGER
>x=null
>FOR k=1 TO 5000000
>	newX=GetAsyncKeyState( VK_SHIFT ) < 0
>	IF m.newX = m.x
>		LOOP
>	ENDIF
>	x=m.newX
>	WAIT WINDOW IIF(m.x,"now is down","now is up") NOWAIT NOCLEAR
>NEXT
>WAIT CLEAR
>
Thanks Fabio. WIll do.
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