Recognition of the Class Name

Class library usage, coding and language questions.
CookieMonster
Certified Professional
Certified Professional
Posts: 74
Joined: Mon Aug 14, 2006 7:17 pm
Location: CH

Recognition of the Class Name

Post by CookieMonster » Wed Aug 16, 2006 7:41 am

I made an application in VS2005 to test ranorex, for e.g I couldn't use the Form.FindClassName("Form1") I hade to use Form.FindClassName("WindowsForms10.Window.8.app.0.378734a"). Is there a possibility to make the class name visible?

Thanks
Dan

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Wed Aug 16, 2006 9:22 pm

The class name you see in RanorexSpy is not the name of the class in your source code.
Handle, Class name and ControlId are old properties of a window.
See also: http://windowssdk.msdn.microsoft.com/en ... 32596.aspx

Use these properties only if you want to automate an old windows application.
In .NET applications the ControlId is different every time you launch the form, so you cannot use this as your identifier. The class name is also dynamically generated.
Use the Control name property to find a control in a .NET application.

See also: http://msdn.microsoft.com/library/defau ... wforms.asp

Jenö Herget
Ranorex Team

puyopuy
Posts: 2
Joined: Thu Jul 26, 2007 6:45 am

Post by puyopuy » Thu Jul 26, 2007 7:02 am

Hi admin,

I'm developing a new application using .NET what property should I use for identifier? My new application will support multiple languages, so I cannot use Form Title as identifier?

Thanks
Jeff

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Thu Jul 26, 2007 6:02 pm

...what property should I use for identifier?
You can use the Name of the Form, we have no Application.FormFindName at the moment, but you can find the Form by Name easily as follows:

Code: Select all

foreach (Form form in Application.Forms) 
{ 
    if (form.Name == "SearchedForm" ) 
    { 
        form.Activate(); 
        break; 
    } 
} 
Jenö
Ranorex Team

puyopuy
Posts: 2
Joined: Thu Jul 26, 2007 6:45 am

Post by puyopuy » Fri Jul 27, 2007 12:24 am

Thanks Jenö, you help is much appreciated