Currently im working on a WINAPI keyboard input event-driven system. With not much success I am not fluent in win API so im sure I am either not using it correctly or I am missing something...possibly both .
#define _WIN32_WINNT 0x0500
#include "windows.h"
int main()
{
MSG msg;
//HWND consoleWindow = GetForegroundWindow();
while (true)
{
if (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return 0;
}
obviously while true is just for debug purposes. So what I am trying to do is pull the applications messages from first key to last. However this code never moves pass the PeekMessage if statement. I have tried passing the consoleWindow handle as well and still nothing.
-this is a command Line window
-I am trying to get every key that is being pressed not just the last one so if I press 10 keys at once I need to be able to see 10 instances of KEYDOWN