Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting when a key is being held down in realtime
Message
 
À
11/01/2002 01:24:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00603357
Message ID:
00603421
Vues:
17
This message has been marked as the solution to the initial question of the thread.
Malcolm,

Have you checked out the GetKeyState Windows API? I've used it for Shift and Ctrl but the MSDN help says you can check of character keys as well.

>Is there a Windows API function to determine if a user is holding down a particular key?
>
>I want to be able to poll for a specific key down status in realtime (while a user is still holding down a specific key) vs. being dependent on the KeyPress event which reads an easily flooded keyboard typeahead buffer.
>
>In other words, I would like to stop a specific action as soon as a user removes their finger from the key they are holding down vs. waiting for the user's keyboard buffer to empty (which could be many seconds after they have stopped holding down a specific key)
>
>I've tried various settings of typeahead (as well as clearing the typeahead buffer). I've also tried 'eating' keystrokes via the following ...
>
>
>* example: eat all space keystrokes in keyboard buffer
>do while inkey() == 32
>enddo
>
>
>The inkey() technique above results in a very 'jittery' feel. I use a similar technique in a command button's mousedown() event to trigger multiple click() events while a user presses on a command button and this behaviour is very smooth. I'm hoping I can emulate the same smooth behavior via an equivalent of a (polled?) KeyDown event.
>
>Thanks!
Caroline
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform