title: c++ global hooking. Why SetWindowsHookEx return NULL?
body: <p>I have a big problem with SetWindowsHookEx and WH_CALLWNDPROC! When use SetWindowsHookEx for local hook </p>
  
  <pre><code>HHOOK hook = SetWindowsHookEx(WH_CALLWNDPROC, CallWndProc, GetModuleHandle(NULL), GetCurrentThreadId());
  </code></pre>
  
  <p>all work fine, but when i try set global hook or hook for other program:</p>
  
  <pre><code>HHOOK hook = SetWindowsHookEx(WH_CALLWNDPROC, CallWndProc, GetModuleHandle(NULL), threadId);
  </code></pre>
  
  <p>where <code>threadId = GetWindowThreadProcessId(window, NULL);</code> <br>
  and <code>HWND window = ::FindWindow(NULL,"Program title");</code></p>
  
  <p>i get NULL in hook... </p>
  
  <p>I read very much for hooking but, i don't understand where is worng...
  I have a headache for a few days.
  Thank you in advance and sorry for my english.</p>