title: SendInput can't send keyboard inputs when the LowLevelKeyboardProc hook is enabled on Windows
body: <p>I made the program that will block every keyboard button on Windows using WinAPI and send a string using SendInput function but I couldn't find a way to make SendInput send keyboard keys while the hook is enabled. Here is my code:</p>
  <pre><code>#include &lt;Windows.h&gt;
  #include &lt;vector&gt;
  #include &lt;string&gt;
  
  HHOOK kHook;
  KBDLLHOOKSTRUCT kbdStruct;
  
  LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) {
      kbdStruct = *((KBDLLHOOKSTRUCT*)lParam);
      if (nCode == HC_ACTION)
      {
          if (kbdStruct.flags != LLKHF_INJECTED)
          {
              switch (wParam)
              {
              case WM_KEYDOWN:
                  return -1;
              case WM_SYSKEYDOWN:
                  return -1;
              }
              return CallNextHookEx(kHook, nCode, wParam, lParam);
          }
      }
  }
  
  void sendString(std::wstring message)
  {
      for (auto ch : message)
      {
          Sleep(250);
          std::vector&lt;INPUT&gt; vec;
          INPUT input = { 0 };
          input.type = INPUT_KEYBOARD;
          input.ki.dwFlags = KEYEVENTF_UNICODE;
          input.ki.wScan = ch;
          vec.push_back(input);
  
          input.ki.dwFlags |= KEYEVENTF_KEYUP;
          vec.push_back(input);
  
          SendInput(vec.size(), vec.data(), sizeof(INPUT));
      }
  }
  int main()
  {
      kHook = SetWindowsHookExW(WH_KEYBOARD_LL, LowLevelKeyboardProc, NULL, 0);
      MSG msg;
      while (GetMessageW(&amp;msg, NULL, 0, 0))
      {
          sendString(L&quot;Some String&quot;);
      }
  }
  </code></pre>