title: C# SendMessage click button
body: <p>Im trying to understand the <code>SendMessage</code> function and here's my actual code:</p>
  
  <pre><code>[DllImport("user32.dll")]
  public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
  
  [DllImport("user32.dll")]
  private static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle);
  
  static void Main(string[] args)
  {
      Process test = Process.GetProcessesByName("calc")[0];
      IntPtr hwndChild = FindWindowEx(test.MainWindowHandle, IntPtr.Zero, "Button", "2");
      SendMessage(hwndChild, 245, IntPtr.Zero, IntPtr.Zero);
      Console.ReadKey();
  }
  </code></pre>
  
  <p>Very simple, I just want to click the calc button 2, but I'm having no success.</p>