For clarity and ease of use I declared the following variables globablly in main.cpp (of the movement demo):
Code: Select all
// a couple of structures to hold the original and updated filterkey info
//
FILTERKEYS original_FilterKeys, irr_FilterKeys;
Code: Select all
// save the user's original filterkey settings
//
ZeroMemory(&original_FilterKeys, sizeof(FILTERKEYS));
original_FilterKeys.cbSize = sizeof(FILTERKEYS);
SystemParametersInfo(SPI_GETFILTERKEYS, sizeof(FILTERKEYS), &original_FilterKeys, 0);
// set the delay values so we get 'instant' response on held keys
//
ZeroMemory(&irr_FilterKeys, sizeof(FILTERKEYS));
irr_FilterKeys.cbSize = sizeof(FILTERKEYS);
irr_FilterKeys.iDelayMSec = 1;
irr_FilterKeys.iWaitMSec = 1;
irr_FilterKeys.iRepeatMSec = 1;
irr_FilterKeys.iBounceMSec = 0;
irr_FilterKeys.dwFlags = FKF_FILTERKEYSON;
SystemParametersInfo(SPI_SETFILTERKEYS, sizeof(FILTERKEYS), &irr_FilterKeys, 0);
Code: Select all
// restore keyfilter settings
//
SystemParametersInfo(SPI_SETFILTERKEYS, sizeof(FILTERKEYS), &original_FilterKeys, 0);