title: C++ keyboard hook - what does the parameter nCode mean?
body: <p>I am looking to write a keyboard hook for a c++ project. I found some code but dont want to use it without fully understanding it:</p>
  <pre><code>HHOOK _hook;
  KBDLLHOOKSTRUCT kbdStruct;
  LRESULT __stdcall HookCallback(int ncode, WPARAM wParam, LPARAM lparam)
  {
      if(ncode&gt;=HC_ACTION)
      {
          if((wParam == WM_KEYDOWN) || (wParam == WM_SYSKEYDOWN))
          {
              kbdStruct = *((KBDLLHOOKSTRUCT*)lParam);
              DWORD dwMsg = 1;
              dwMsg += kbdStruct.scanCode &lt;&lt; 16;
              dwMsg += kbdStruct.flags &lt;&lt; 24;
              char key[16];
              GetKeyNameText(dwMsg,key,15);
              
              if((GetKeyNameState(VK_CAPITAL)&amp; 0x0001) == 0)
              {
                  for (int i=0; i&lt;10)key[i] = tolower(key[i]);
                  ReturnKeyPressed(key);
              }
              else
              {
                  ReturnKeyPressed(key);
              }
          }
      }
      return CallNextHookEx(_hook,nCode,wParam,lParam);
  }
  void SetHook()
  {
      _hook = SetWindowsHookEx(WH__KEYBOARD_LL,HookCallback,Null,0);
  }
  </code></pre>
  <p>I dont understand what nCode is here. And where do the other parameters come from?
  Greeting from an absolute C++ beginner :).</p>