title: Handling SetWindowsHookEx zero return value
body: <p>I have used in module this helper class: <a href="http://tinyurl.com/pb3vxw6" rel="nofollow">http://tinyurl.com/pb3vxw6</a> and I have following problem: SetWindowsHookEx always returns zero value.  As I mentioned this API function is not documented. Is this API function still supported in Win CE 6.0 devices? Should I use another API function? How can realize keyboard hooks in another way?  </p>
  
  <pre><code>public void Start()
  {
      if (hHook != 0)
      {
           // Unhook the previouse one
           this.Stop();
      }
  
      hookDeleg = new HookProc(HookProcedure);
      // in hHook returned zero value  
      hHook = SetWindowsHookEx(WH_KEYBOARD_LL, hookDeleg, GetModuleHandle(null), 0);
  
      if (hHook == 0)
      {  // Exception throwed
         throw new SystemException("Failed acquiring of the hook.");
         // May be better?
         // Marshal.ThrowExceptionForHR(Marshal.GetLastWin32Error());
  
      }
  }
  </code></pre>