|
How do I test bit 31?
I''ve read in MSDN that a certain keyboard shows call shows the keypress state by testing bit 31 of the lparam. Apparently a define lists it as KF_UP.
MSDN says this(Search string : Keystroke Message Flags)
Previous Key-State Flag
The previous key-state flag indicates whether the key that generated the keystroke message was previously up or down. It is 1 if the key was previously down and 0 if the key was previously up. You can use this flag to identify keystroke messages generated by the keyboard''s automatic repeat feature. This flag is set to 1 for WM_KEYDOWN and WM_SYSKEYDOWN keystroke messages generated by the automatic repeat feature. It is always set to 0 for WM_KEYUP and WM_SYSKEYUP messages.
Transition-State Flag
The transition-state flag indicates whether pressing a key or releasing a key generated the keystroke message. This flag is always set to 0 for WM_KEYDOWN and WM_SYSKEYDOWN messages; it is always set to 1 for WM_KEYUP and WM_SYSKEYUP messages.
So I need to determine:
1) Is the keypress a silly repeat that I need to ignore?
2) Is the keypress event for Pressed or Released.
I attempted this but I seem to have an error in my test as when I press a key I get 2 Pressed events:
I''ve highlighted the potentially offending code. Is this the correct way of testing a bit?
Many thanks
Chris
Chris Brodie
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement