title: How to write and send text to mIRC in C#/Win32?
body: <p>In a previous question, I asked <a href="https://stackoverflow.com/questions/523405/how-to-send-text-to-notepad-in-c-win32">how to send text to Notepad</a>.  It helped me immensely.  For part 2, here's a simplified version of the same applied mIRC:</p>
  
  <pre><code>[DllImport("User32.dll", EntryPoint = "FindWindow")]
  public static extern IntPtr FindWindow(String lpClassName, String lpWindowName);
  [DllImport("user32.dll", EntryPoint = "FindWindowEx")]
  public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
  [DllImport("User32.dll")]
  public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam);
  
  IntPtr mainHandle = FindWindow("mIRC", null);
  IntPtr serverHandle = FindWindowEx(mainHandle, new IntPtr(0), "MDIClient", null);
  IntPtr chanHandle = FindWindowEx(serverHandle, new IntPtr(0), "mIRC_Channel", null);
  IntPtr editHandle = FindWindowEx(chanHandle, new IntPtr(0), "Edit", null);
  
  SendMessage(editHandle, 0x000C, 0, textBox1.Text);
  </code></pre>
  
  <p>This seems correct to me, except that it doesn't work!  Is it that the window names are incorrect (MDIClient, mIRC_Channel, and Edit)?  These are values I found on a web site by googling "FindWindowEx mIRC".</p>
  
  <p>1.)  What am I doing wrong in the above?</p>
  
  <p>2.)  For reference, in general is there an easy way to find all the Window names for use with <code>FindWindowEx()</code>?</p>