Page 1 of 1

Find window with title and class name?

Posted: Sun Feb 18, 2007 9:28 pm
by bszot
Can a window be searched with title and class name?
We have sometimes more than one application with the same title but with different class names.

Thanks

Ben

Posted: Mon Feb 19, 2007 11:44 pm
by webops
We have already implemented the function FormFind(title and className) for the next release V1.1.0.
Please search the window in V1.0.0 as follows:

Code: Select all

Form form = null;
Application.GetForms();
foreach (Form topform in Application.Forms)
{
    if( topform.Text == "title" && topform.ClassName == "className")
    {
        form = topform;
        Console.WriteLine("Handle={0} Location={1} Text={2} ClassName={3}", 
                               form.Handle, form.Location, form.Text, form.ClassName);
	break;
    }
}
Jenö