Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reliably detecting keystrokes
Message
From
20/03/2006 04:56:25
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01105675
Message ID:
01105742
Views:
30
Hello,

keyboard drivers can map their keys to different virtual key codes.
Checking for 'Z' & 'R' instead of Left/PageUp maybe more reliable.
*** Ctrl-Z
IF nKeyCode = 26
	lnKeyState = GetKeyState(ASC('Z'))
	IF lnKeyState < 0 && only Z is pressed
	 WAIT WINDOW "CTRL-Z" NOWAIT NOCLEAR     	
	 NODEFAULT
	ELSE
     	WAIT WINDOW "CTRL-Left" NOWAIT NOCLEAR     	
	ENDIF
ENDIF

*** Redo
IF nKeyCode = 18
     lnKeyState = GetKeyState(ASC('R'))
     IF lnKeyState < 0
	WAIT WINDOW "CTRL-R" NOWAIT NOCLEAR     
        NODEFAULT
     ELSE
	WAIT WINDOW "PageUp" NOWAIT NOCLEAR     	
     ENDIF
ENDIF
during testing it was not 100% reliable, sometimes after a succession of CTRL-R or CTRL-Z keypresses the WAIT WINDOW showed PageUp/CTRL-Left for a short period of time and the defaultbehaviour of the editbox was triggered.

You have a great blog by the way, i'v recently done some webdevelopment and was surprised to find a solution for showing animated gifs during a form POST on your blog.

Regards
Christian
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform