Thursday, June 28, 2012

#win32: a tool to set the keyboard repeat rate

i have a windows 7 machine and every time it exits sleep mode it (re)sets the keyboard repeat rate to a very low value (i normally set the value to high). i believe this could be due to a small driver issue.

here is a command line tool that can be used to get/set the kb rate value (source code included):

setkbrate n
where n is a number between 0 (slowest) and 31 (fastest).
calling with no arguments will output the current rate.

the way to use it when the system exits sleep mode is to set a new task scheduler task:

1) control panel -> system and security -> administrative tools -> task scheduler
2) right click the task list -> create basic task
3) for triggers, one way would be to try to capture the system "exit sleep mode" event:
- set trigger mode to "on an event", log: "system",  source: "power-troubleshooter", id: "1" (should be 1, but  has to be verified in the event log)
4) for the action select "start a program" then browse and set to "setkbrate.exe", while adding a numeric argument of 0-31.