How to manage this? I just know it must deal woth hooks, but how?
Also: how to test the time between pressure of two keys? Please, advice the technique or send an url for the source (if exists)
Posted on 2002-01-09 12:00:13 by Maestro
WH_KEYBOARD_LL

SetWindowsHookEx - look it up on MSDN. To get time between keypresses, just take time2 - time1 ;). Sorry can't say more but I'm having lunch and don't feel like typing.
Posted on 2002-01-09 12:19:47 by lackluster
Maestro,

This may help, at the time the key is pressed do


.data?
system_time SYSTEMTIME <> ;used to gather current time
time_now FILETIME <> ;used to gather current time
;The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601.
.code
invoke GetLocalTime, addr system_time ;Get Local Time
invoke SystemTimeToFileTime, addr system_time, addr time_now
;convert that system time into a file time to make comparison easier


The FILETIME structures are nice for doing math
on two time values. Multiply by 10,000,000 to
convert to seconds.

farrier
Posted on 2002-01-10 01:59:20 by farrier
Don't you mean divide? :tongue:.
Also, GetTickCount might be enough if you just need to find the
time between two keypresses - not like a user will be faster than
that. And then you don't need to bother with 64bit values.

Just my .5DKK.
Posted on 2002-01-10 04:59:36 by f0dder
Why do you guys have to make it diffiicult ? :tongue:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/hooks_6fc3.asp

Set the Low-Level Keyboard hook & lParam will be a pointer to a KBDLLHOOKSTRUCT (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/hooks_0cxe.asp) which has a time member.


Originally Posted on MSDN:
typedef struct tagKBDLLHOOKSTRUCT {
DWORD vkCode;
DWORD scanCode;
DWORD flags;
DWORD time;
ULONG_PTR dwExtraInfo;
} KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;
Members
vkCode
Specifies a virtual-key code. The code must be a value in the range 1 to 254.
scanCode
Specifies a hardware scan code for the key.
flags
Specifies the extended-key flag, event-injected flag, context code, and transition-state flag. This member is specified as follows. Value Description
0 Specifies whether the key is an extended key, such as a function key or a key on the numeric keypad. The value is 1 if the key is an extended key; otherwise, it is 0.
1-3 Reserved.
4 Specifies whether the event was injected. The value is 1 if the event was injected; otherwise, it is 0.
5 Specifies the context code. The value is 1 if the ALT key is pressed; otherwise, it is 0.
6 Reserved.
7 Specifies the transition state. The value is 0 if the key is pressed and 1 if it is being released.


An application can use the following values to test the keystroke flags. Value Purpose
LLKHF_EXTENDED Test the extended-key flag.
LLKHF_INJECTED Test the event-injected flag.
LLKHF_ALTDOWN Test the context code.
LLKHF_UP Test the transition-state flag.



time
Specifies the time stamp for this message.
dwExtraInfo
Specifies extra information associated with the message.
Posted on 2002-01-10 09:46:16 by lackluster
Doh! Sometimes it might help to read up on the APIs :rolleyes:

:stupid:
Posted on 2002-01-10 09:50:50 by f0dder
f0dder,

Don't you mean divide?


Yes, otherwise an even bigger number! Maestro
mentioned "time" which led me to my answer, didn't
think elapsed time only.

lackluster,

Why do you guys have to make it diffiicult ?


I'm still using Win95, don't laugh!:(
I'm still looking for a description of the DWORD
time, time stamp in that structure.

thanks,

farrier
Posted on 2002-01-10 11:30:26 by farrier