title: how to suppress keyboard input
body: <p>So I am trying to make a program that disables all keyboard input but can still detect when a key is being pressed (doesn't matter which).</p>
  
  <p>I tried using the <code>BlockInput</code> method but it blocked ALL input (mouse and keyboard) and wouldn't allow for further detection of keyboard press.</p>
  
  <p>This is my current code (function is a timer with a 1 tick interval)</p>
  
  <pre><code>private void detect_key_press_Tick(object sender, EventArgs e)
      {
          Process p = Process.GetCurrentProcess();
          if (p != null)
          {
              IntPtr h = p.MainWindowHandle;
              //SetForegroundWindow(h);
              if (Keyboard.IsKeyDown(Key.A))
              {
                  //SendKeys.SendWait("k");
                  this.BackColor = Color.Red;
  
              }
              else
              {
                  this.BackColor = Control.DefaultBackColor;
              }
          }
      }
  </code></pre>
  
  <p>How can I do this please? Thanks.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I tried</p>
  
  <pre><code>private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
      {
          e.Handled = true;
          e.SuppressKeyPress = true;
      }
  </code></pre>
  
  <p>but no success. Keys still get proccessed.</p>