title: Problem on Hooking Keyboard Messages using SetWindowsHookEx
body: <p>I 'm trying to hook on Keyboard Messages without any success.</p>
  
  <p>I create a test console win32 app:</p>
  
  <pre><code>int _tmain(int argc, _TCHAR* argv[])
  {
  HOOKPROC hHookProc;
  HINSTANCE hinstDLL; 
  HHOOK hHook; 
  
  hinstDLL = LoadLibrary(TEXT("pathtodll\\KeyHook.dll")); 
  hHookProc= (HOOKPROC)GetProcAddress(hinstDLL, "HookProc"); 
  
  hHook = SetWindowsHookEx( 
      WH_KEYBOARD,
      hHookProc,
      hinstDLL,
      0);
  
      while (1) {}
  
  return 0;
  }
  </code></pre>
  
  <p>I've also created a test win32 dll with the HookProc function:</p>
  
  <pre><code>extern __declspec(dllexport) LRESULT CALLBACK HookProc(
    int nCode, 
    WPARAM wParam, 
    LPARAM lParam
  )
  {
     // process event
     //...
       MessageBox( NULL,
                  TEXT("OK"),
                  TEXT("OK"),
                  MB_OK);
  
     return CallNextHookEx(NULL, nCode, wParam, lParam);
  }
  </code></pre>
  
  <p>Everything compiles fine but when I'm trying to debug, it seems that HookProc is never called. Actually in Win 7 the app hangs when i press any key, while in Win Xp HookProc is not called. I do get not NULL hinstDLL, hHookProc, hHook.</p>
  
  <p>What am I misssing?</p>