Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reliably detecting keystrokes
Message
De
20/03/2006 04:56:25
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01105675
Message ID:
01105742
Vues:
34
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform