Help with Keyboard Event Handling

Problem: How do you disable auto repeat on key down and make it so that the computer doesn't respond to that keystroke only until its back up in the key up position?

Resources: I found this on another site that was helping me with keyboard handling and even though it does manage events of keystrokes its not quiet what I want.

#include <conio.h>
#include <stdio.h>

int main ()
{
int iCode;

while (1) {
iCode = getch ();
if (iCode == 0) {
iCode = getch ();
printf ("\nEXTENDED KEY CODE: %d", iCode);
}
else { // 'iCode' is not zero
printf ("\nNORMAL KEY CODE: %d", iCode);
}
if (iCode == 27) { // 27 is key code for ESC key
break; // Quit to DOS.
}
}
return 0;
}
closed account (zb0S216C)
You may have to pull-in the Windows API for this. I believe the messages are WM_KEYUP and WM_KEYDOWN. In order to use these messages, you need a Windows application structure. You can still use a console window. However, that requires slightly more work. It would be beneficial to ask in the Windows Programming forum.
Topic archived. No new replies allowed.