title: Keyboard event not sent to window with pywin32
body: <p>I've wrote A code that gets the HWND from any program I want. So thats how I got the hwnd if your asking.</p>
  
  <p>The following code should bring up device manger and send the down arrow to the program.</p>
  
  <p>But it doenst. It does bring up the device manager but it doesnt send the arrow down key to the program, at least nothing happens.</p>
  
  <p>If I change the hwndMain number with the hwnd code of a notepad window, the code does work and sends the arrow down key</p>
  
  <pre><code>import win32api
  import win32con
  import win32gui
  import time
  
  hwndMain = 133082
  hwndChild = win32gui.GetWindow(hwndMain, win32con.GW_CHILD)
  win32gui.SetForegroundWindow(hwndMain)
  time.sleep(1)
  
  win32api.SendMessage(hwndChild, win32con.WM_CHAR, 0x28, 0)
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've tried</p>
  
  <pre><code>win32api.SendMessage(hwndChild, win32con.WM_CHAR, win32con.WM_KEYDOWN, 0)
  </code></pre>
  
  <p>Instead of</p>
  
  <pre><code>win32api.SendMessage(hwndChild, win32con.WM_CHAR, 0x28, 0)
  </code></pre>
  
  <p>But that doesnt work either.</p>
  
  <p>I'm on python 2.7</p>