Control problems

Class library usage, coding and language questions.
tschi2001
Posts: 5
Joined: Fri Feb 15, 2008 10:49 am

Control problems

Post by tschi2001 » Fri Feb 15, 2008 11:00 am

Hello Experts,

I’m new with renorex and want to evaluate it. At first of all I would like to say that it’s a very cool tool!
I downloaded the last release and try the sample .Net Testing -> Samples -> Visual Studio1. There is an example which works with calc.exe. After red that I build my own WindowsApplication with 3 Controls.
After the follow conditional statement the form contains all controls of the calc.exe application.
“form = Application.FindFormClassName("SciCalc", 1, true, 5000)”
Tried the same with my own application and own class name my form contains no controls.

Have someone any ideas?

Best regards,
Tim
Last edited by tschi2001 on Tue Feb 19, 2008 4:53 pm, edited 1 time in total.

tschi2001
Posts: 5
Joined: Fri Feb 15, 2008 10:49 am

Post by tschi2001 » Fri Feb 15, 2008 11:14 am

After Debugging I recognized that my form didn’t contain any information from the base node.
For your Information: the class name of my application I get through the RanorexSpy application

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Fri Feb 15, 2008 1:33 pm

Are you using .NET / Windows Forms for your Application?
If so, your application probably has

"WindowsForms10.Window.8.app.0.b7ab7b"

as class name. This is not unique and other applications can have the same
class name.

So probably your problem is that you find another (invisible) form which has no controls.

If possible, you should search by title. If this is not possible for some reason, you can collect multiple instances (using the FindFormClassName() instance overload) and try to retrieve the Name property to check if it is really your application.

The Spy displays the instance number along with the class name:
WindowsForms10.Window.8.app.0.b7ab7b #2

Note that the instance number is likely to change when restarting the application, as it depends on which applications you have running;
We recommend not to use instances for Forms if possible.

Michael
Ranorex Support Team

tschi2001
Posts: 5
Joined: Fri Feb 15, 2008 10:49 am

Post by tschi2001 » Mon Feb 18, 2008 8:14 am

Hello,

Yes I use .Net.
After used your class name and thread.sleep function my application going well.
My code looks like this:

Application.Start("WindowsApplicationGUITest.exe");
Thread.Sleep(5000);
form = Application.FindFormClassName("WindowsForms10.Window.8.app.0.b7ab7b");

If I didn’t use the sleep function, my code was faster as the started .exe application and the form variable get a null value.

Thanks a lot!