title: Click a button in another application
body: <p>I want yo use <code>SendMessage</code> or <code>PostMessage</code> to press a button in another app</p>
  
  <p>i have a sample code to do this  by getting Window Handle, but it doesn't work</p>
  
  <p>also i used "WinDowse"  to get required info. here is the code</p>
  
  <pre><code>private const uint BM_CLICK = 0x00F5;
  private const uint WM_LBUTTONDOWN = 0x0201;
  private const uint WM_LBUTTONUP = 0x0202;
  
  private void PushOKButton(IntPtr ptrWindow)
  {
      WindowHandle = FindWindow(null, "Form1"); 
      if (ptrWindow == IntPtr.Zero)
        return;
  
      IntPtr ptrOKButton = FindWindowEx(ptrWindow, IntPtr.Zero, "Button", "&amp;Yes");
  
      if (ptrOKButton == IntPtr.Zero)
        return;
  
      SendMessage(ptrOKButton, WM_LBUTTONDOWN, 0, 0);
      SendMessage(ptrOKButton, WM_LBUTTONUP, 0, 0);
      SendMessage(ptrOKButton, BM_CLICK, 0, 0);
  }
  </code></pre>
  
  <p>is There a Compelete Suloution in c# ?</p>