How can a Win32 application respond to only the first WM_KEYDOWN notification? The MSDN docs claim bit 30 "Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up." but bit 30 is always 0 in my WndProc.
case WM_KEYDOWN:
// ToDo - stop multiple notifications for repeating keys
printf("WM_KEYDOWN %i %i", wParam, lParam & 30);
return 0;
Is lParam & 30 the wrong way to ask for this? Am I doing something else wrong?
To test bit 30 don't AND with 30, instead AND with 1 << 30.
const bool isBitSet = lParam & (1 << 30);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With