Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test for Shift Key
Message
From
26/09/2005 09:57:42
 
 
To
26/09/2005 09:12:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01052949
Message ID:
01053024
Views:
8
This message has been marked as a message which has helped 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?
>>
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform