WM_KEYDOWN message pause

Hi all!

First of all, some additional info:
in the wParam parameter of WM_KEYDOWN message, first 15 bits have the following meaning:
"0-15 The repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative."

So, what i want to do is, when i hold down s button on keyboard (or a mouse for that matter), i would like that this button would continuously be sending WM_KEYDOWN message, without the pause, which occurs after the first message - that is, if you hold down button, first message is sent, than for a second nothing happens, and after that, if your still holding down that same button, these type of messages are sent quick one after another. How to accomplish such a funcionality? If your not sure what i mean, you can open text editing program such as textbook and hold one specific character on the keyboard down, and you will see the short pause right after the first output of that same character, after that, it will be outputed constantly.
It's a system wide config item.
http://windows.microsoft.com/en-US/windows-vista/Change-keyboard-settings

If you want something app specific, you'll need to do it yourself by monitoring key-down and key-up messages.
Last edited on
If you want something app specific, you'll need to do it yourself by monitoring key-down and key-up messages.


Well thats what im asking, how to do just that.
Last edited on
Basically, you need to implement your own keyboard delay. So you need to a Finite State Machine.

I could imagine it working like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- Initial state is do nothing

- If a key is pressed:
  - set state to key-down
  - record the key-down time
  - record the key
  - start a timer

- If ub key-down state and timer fires
  - pretend you received a repeat

- If in key-down state and the key is released
  - stop timer
  - clear key-down time
  - clear key
  - set state to initial
Last edited on
Topic archived. No new replies allowed.