Re: Keypad driver long keypress
Dhanesh D Pai <[email protected]> Tue, 01 Feb 2005 09:43:52 +0530
| Newsgroups | gmane.comp.windows.ce.freeware |
|---|---|
| Message-ID | <[email protected]> |
Tomal wrote:
> I'm struck implementing the long keypresses. Kindly suggest me a way
> to implement the same.
>
One solution will be make a note of time for which the key is pressed.
It can be somthing like this
Once you get the WM_KEYDOWM msg make a note of the GetTickCount return
value.
Next for the same key when you get the WM_KEYUP msg substract the
current GetTickCount with the previously stored value.
i.e duration = currect_tick - last_tick
Now that when you say __shortkeypress__ and __longkeypress__ it
is implied that it has something to do with the time duration for which
it is pressed.
Now you have to decide what duration is short for you and what is
long ...One example case may be
if ( duration > 300) /* in msec*/
{
/* its a longer press*/
}
else
{
/*its a shorter press */
}
There may be better ways to do ..this is one...if you find a better way
do post me also.
regards
-d