title: Finding handle for a button in the window of another program
body: <p>I need some help. I wrote my questions at the end and will first explain what exactly my code is supposed to do:</p>
  
  <p>I am making a program that will communicate with other programs. What I need my software to do is be able to click on a button on another program, and I believe the appropriate code to do this would be:</p>
  
  <pre><code>SendMessage(hWnd, Msg, wParam, lParam);
  </code></pre>
  
  <p>with</p>
  
  <pre><code>Msg = B_Click
  wParam = 0;
  lParam = 0;
  </code></pre>
  
  <p>however I am not sure how to get the <code>hWnd</code> which is the handle of a specific button on a specific window of another program that is running at the same time. I have read somewhere that I could possibly do the following:</p>
  
  <pre><code>HWND buttonHandle = FindWindowEx(hwndParent, hwndChildAfter, lpszClass, lpszWindow);
  </code></pre>
  
  <p>where:</p>
  
  <pre><code>HWND hwndParent = A handle to the parent window whose child windows are to be searched
  HWND hwndChildAfter = if its null child windows are of the parent window are looked through
  LPCTSTR lpszClass = (NOT SURE WHAT THIS IS)
  LPCTSTR lpszWindow = (NOT SURE WHAT THIS IS)
  </code></pre>
  
  <p>I have a few issues with the <code>FindWindowEX()</code> function however. </p>
  
  <p><strong>Question 1:</strong>  The window I am looking at has various buttons, so how would the function know which one of the 3 i am looking at?</p>
  
  <p><strong>Question 2:</strong>  What are the <code>lpszClass</code> and <code>lpszWindow</code> variables and how might I get them?</p>
  
  <p><strong>Question 3:</strong> Is this even the right approach? If it's not, please point me to the right direction!</p>