title: Check if key is pressed on background using win32api
body: <p>I'm trying to make a simple Python script to capture image from my webcam on workstation unlock.
  And I am making a "kill switch" that checks if key is pressed and if it does the program will not run.
  My problem is that I need to check if key is pressed and I can't find a way to do that.
  I have tried this:</p>
  
  <pre><code> keyState = win32api.GetAsyncKeyState(17)
  </code></pre>
  
  <p>But it does not work.</p>
  
  <p>From the documentation:</p>
  
  <blockquote>
    <p>The return value is zero if a window in another thread or process
    currently has the keyboard focus.</p>
  </blockquote>
  
  <p>So it doesn't really help me.
  I'm on Windows btw.</p>