title: multiple keypress in vb.net
body: <p>What I am trying to do is handle an event in which an end user pounds the keyboard with his palm, fist, face, etc. Sounds ridiculous but it will be used as a supplemental safety feature in a high-power laser lab. I was thinking of watching for 4 or more keys. Examples of valid combinations:</p>
  
  <pre><code>- u{f5}7hby6
  - 6g3.io{alt}mn'
  - p9hyi
  - {tab}2{f2}56{shift}z
  - {alt}{windows}\{ctrl}{f8}
  - basically anything else that can be typed with a face
  </code></pre>
  
  <p>I have tried this method, which doesn't work because not all KeyUp or KeyDown events are handled especially when multiple keys are pressed.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Private keez As New List(Of Integer)
  
  Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
      keez.Add(e.KeyValue)
      If keez.Count &gt;= 4 Then MessageBox.Show("I handled it!")
  End Sub
  
  Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
      Try
          keez.Remove(AscW(e.KeyChar))
      Catch
      End Try
  End Sub
  
  Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
      keez.Remove(e.KeyValue)
  End Sub
  </code></pre>
  
  <p>With this method, keys are missed constantly. I'm wondering if anyone knows of a way to handle multiple keys pressed consecutively. Most Google searches are related to standard key combos which almost always include a modifier (ctrl, alt, shift) + one additional key.</p>