Find window with title and class name?

Ask general questions here.
bszot
Posts: 3
Joined: Sat Jul 22, 2006 8:25 am

Find window with title and class name?

Post by bszot » Sun Feb 18, 2007 9:28 pm

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

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Mon Feb 19, 2007 11:44 pm

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ö