title: does not go inside the Windows GetMessage loop on console application
body: <p>I want to detect keypress in C++ and i need to use Windows System Call. So, i did some research and this is what i got using Hooks and Message:</p>
  
  <pre><code>#include &lt;Windows.h&gt;
  #include &lt;iostream&gt;
  #include &lt;sstream&gt;
  #include &lt;fstream&gt;
  #include &lt;ctime&gt;
  
  using namespace std;
  
  LRESULT CALLBACK LowLevelKeyboardProc(int code, WPARAM wParam, LPARAM lParam) {
      if (code == HC_ACTION) {
          switch (wParam) {
          case WM_KEYDOWN:
              PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT)lParam;
              char c = char(MapVirtualKey(p-&gt;vkCode, MAPVK_VK_TO_CHAR));
              cout &lt;&lt; c &lt;&lt; endl;
          }
      }
      return CallNextHookEx(NULL, code, wParam, lParam);
  }
  
  int main() {    
      HHOOK HKeyboard = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, 0, 0);
  
      MSG msg;
      BOOL bRet;
  
      while ((bRet = GetMessage(&amp;msg, NULL, 0, 0)) &gt; 0) {
          cout &lt;&lt; "bRet = " &lt;&lt; bRet &lt;&lt; endl; // I want to do something here, but the program doesn't seem to go in here
          TranslateMessage(&amp;msg);
          DispatchMessage(&amp;msg);
      }
  
      UnhookWindowsHookEx(HKeyboard);
      return 0;
  }
  </code></pre>
  
  <p>My question is why my program doesn't go inside the loop(and instead stuck on GetMessage function)? I need it to set conditions to terminate after some seconds, so where should i put the conditions? I know the GetMessage function reads Message, but when i press keys on my keyboard it still not going in and the callback function works just fine.</p>