title: Can't catch the screen saver event
body: <p>I'm trying to catch the screen saver event. This is my code:</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include "stdio.h"
  
  #include &lt;Windows.h&gt;
  
  #include &lt;strsafe.h&gt;
  
  HHOOK _hook;
  
  LRESULT CALLBACK HookCallback(int nCode, WPARAM wParam, LPARAM lParam)
  {
      if (nCode &gt;= 0)
      {   
          LPMSG msg = (LPMSG)lParam;
  
          if(msg-&gt;message == WM_SYSCOMMAND)
          {
              if (msg-&gt;wParam == SC_SCREENSAVE)
              {
                  std::cout&lt;&lt;"SC_SCREENSAVE\n";
              }
          }
  
      }
  
      return CallNextHookEx(_hook, nCode, wParam, lParam);
  }
  
  void SetHook()
  {
      HINSTANCE hinstDLL = LoadLibrary(L"user32.dll");
      if (!(_hook = SetWindowsHookEx(WH_GETMESSAGE,HookCallback,hinstDLL,0)))
      {
          std::cout&lt;&lt;"Failed to install hook!\n";
      }
  }
  
  void ReleaseHook()
  {
      UnhookWindowsHookEx(_hook);
  }
  
  
  int _tmain(int argc, _TCHAR* argv[])
  {
  
      SetHook();
  
  
      // Don't mind this, it is a meaningless loop to keep a console application running.
      // I used this to test the keyboard hook functionality. If you want to test it, keep it in ;)
      MSG msg;
      while (GetMessage(&amp;msg, NULL, 0, 0))
      {
  
      }
      ReleaseHook();
      return 0;
  }
  </code></pre>
  
  <p>The registration is successful. But I'm not catching the event. Not even getting inside the callback function. What am I doing wrong?</p>