title: SendMessage WM_LBUTTONDOWN/UP works on buttons but not window
body: <p>I am trying to send some simple mouse down/up messages to Windows Calculator using SendMessage. I have been able to press the buttons by sending the messages to the buttons directly. However, I have not been able to successfully send the same messages to the main calculator window handle. Given that hWnd is the window handle to calculator, this is my code.</p>
  
  <pre><code>IntPtr fiveKey = FindWindowEx(hWnd, IntPtr.Zero, "Button", "5"); 
  
  int x = 5; // X coordinate of the click
  int y = 5; // Y coordinate of the click
  
  IntPtr lParam = (IntPtr)((y &lt;&lt; 16) | x); // The coordinates
  IntPtr wParam = IntPtr.Zero; // Additional parameters for the click (e.g. Ctrl)
  const uint downCode = 0x201; // Left click down code
  const uint upCode = 0x202; // Left click up code
  SendMessage(fiveKey, downCode, wParam, lParam); // Mouse button down
  SendMessage(fiveKey, upCode, wParam, lParam); // Mouse button up
  </code></pre>
  
  <p>Can anyone explain to me why sending the messages to hWnd instead of fiveKey with the x/y offsets changed to the position of the "5" key does not work? I would like to eventually use this code to simulate mouse clicks on a different application that doesn't have buttons like calculator.</p>