Alright so my code below works but it does not wait for a key to be pressed it just reads it once and then goes on its way. How would I go about waiting for a key pressed event to occur and then use the ReadConsoleInput function.
Code:
DWORD Read;
INPUT_RECORD Event;
/* Get console input */
ReadConsoleInput (GetStdHandle(STD_INPUT_HANDLE), &Event, 1, &Read);
/* If input event is a key event see if there is any key pressed
and return its virtual-key code */
if(Event.EventType == KEY_EVENT)
{
if (Event.Event.KeyEvent.bKeyDown)
{
return Event.Event.KeyEvent.wVirtualKeyCode;
}
}
return 0;
I have tried the WaitForSingleObject function but to no avail...