Skip to content

Instantly share code, notes, and snippets.

@Affonso-Gui
Created March 3, 2024 22:10
Show Gist options
  • Save Affonso-Gui/4ae0edfbaeb60111192a7c7a48c1ac6d to your computer and use it in GitHub Desktop.
Save Affonso-Gui/4ae0edfbaeb60111192a7c7a48c1ac6d to your computer and use it in GitHub Desktop.
WinAPI - Change repeat key rate
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
// ref. https://github.com/EricTetz/keyrate
// Compile from Developer PowerShell for VS with:
// cl /Fe$@ /DWIN32_LEAN_AND_MEAN /O1 /Oa /Og /Os /Oy /Oi user32.lib $?
int main(int argc, char* argv[])
{
FILTERKEYS keys = { sizeof(FILTERKEYS) };
keys.iDelayMSec = 230;
keys.iRepeatMSec = 30;
keys.dwFlags = FKF_FILTERKEYSON|FKF_AVAILABLE;
if (!SystemParametersInfo (SPI_SETFILTERKEYS, 0, (LPVOID) &keys, 0))
{
fprintf (stderr, "System call failed.\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment