Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trapping duration of keypress event in VFP?
Message
De
20/04/2013 06:03:20
 
 
À
19/04/2013 23:46:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01571521
Message ID:
01571527
Vues:
64
Use BINDEVENT(thisForm.hwnd, WM_KEYDOWN, thisForm, "myCustomKeyDownMethod") and BINDEVENT(thisForm.hwnd, WM_KEYUP, thisForm, "myCustomKeyUpMethod") to trap matched key pairs.

Each of those functions should populate an array with the key and SECONDS() when pressed, and when released use SECONDS() - x to get the press duration. You can also the trap release intervals the same way, only the reverse functions.

Per MSDN:
WM_KEYDOWN = 0x100
WM_KEYUP = 0x101

For your custom key methods, use:
LPARAMETERS tnHwnd, tnMsg, tnVkey, tnExtra

Each time it's called, tnVkey indicates the key that was pressed or released. See this list for codes:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx



>Hey guys,
>
>I'm a little frustrated here. Does anyone know if it's possible, and how, to trap the duration of a key-press event in VFP? I have various versions available (up to 9) but cannot find any way of doing this. I'm assuming this is not supported via general VFP functions but I'm looking for any solution with decent resolution (on the orfder of 5ms or there about). Any thoughts? I'm attempting to build a Morse code trainer in VFP as I've not really found a single piece of S/W out there that does all the things I'd like in a true Morse trainer. If anyone's interested in this, I plan on making this GNU/Open Source with detailed plans for a USB interface to a Morse key. To be able to do this properly in VFP will require being able to detect the length (in ms) of a key-press event. If it turns out there's no obvious way to do this in VFP then I'll have to (ugh :p) do this in VB.
>
>Any thoughts appreciated.
>
>-Arne
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform