I am writing a .Net application trying to automate keystrokes in a Thin Terminal called Persona. I can open the program and set my focus to it but what I need to do is click the connect button in the menu bar. I used Spy++ to look at the window properties.
This is my result.
http://imageshack.us/photo/my-images/27/unledxsp.png/
[DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindow(string lpClassName,
string lpWindowName);
// Activate an application window.
[DllImport("USER32.DLL")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
protected void Button2_Click(object sender, EventArgs e)
{
IntPtr dixiehandle = FindWindow("ToolBar", "Dixie Information Network - Persona");
SetForegroundWindow(dixiehandle);
SendKeys.Send("{ENTER}");
}
I would like to do this but the handle is return 0. Any thoughts?