title: low level Hooker
body: <p>I want to make a hook that will act like "event" (and not with agly GetAsyncKeyState) in C# (I want to do it in C++).
  so, I've made a dll with this content: <a href="http://pastebin.com/yEHJKSS7" rel="nofollow noreferrer">http://pastebin.com/yEHJKSS7</a> .</p>
  
  <p>well, it doesn't call to Handler Function.</p>
  
  <p>by the way, here's how I used the dll: </p>
  
  <pre><code>void KeysHandler(int vkKey, int flags)
  {
      if(vkKey == VK_ESCAPE)
          exit(0);
      File &lt;&lt; vkKey &lt;&lt; endl &lt;&lt; flags &lt;&lt; endl;
  }
  
  int main
  {
      SetHandler(HandlerFunc);
      //sleep here
  }
  </code></pre>
  
  <p>edit: now I saw how I can "debug" in the dll, here are the findings: the SetWindowsHookEx returns 255 - i think it's starnge because it worth to char exactly - I'm going to check in the documentation what does it mean.</p>
  
  <p>edit: 255 is valid return value :O only NULL (0) is error. </p>
  
  <p>I have no idea what's the problem.</p>
  
  <p>edit: well, now my friend brought me a hooker that worked for him. and guess... it didn't work.</p>
  
  <p>I decided it's very strange so I did GetLastError and got 127 - procedure haven't found.
  I don't see any reason my procedure won't be found, help please :(</p>