Environment:Ranorex 2.1,Win7
Target:
before my project is running ,i must close all casual forms ,as some popup, some applications which is shown under special conditions.
Use Host.Local.Children , i can get all forms by compressing conditions ,like title must be "form:xxx"
But how can i identify these forms? I think below condition can determin the forms that should be closed.
1. Visible,Enabled,Valid=True
2. Width,Height<Screen width,Height
3. Must has Close button at upper right
4. Has controls
5. process name <> explorer.exe ,sidebar
How can i know it has Close(X) button????
Close forms
Re: Close forms
You can use Spy to verify this, but the title bar of each form/window should have a push button named "Close" that represents the X. Similarly it may have a Minimize & Maximize push button as well.marcushe wrote: How can i know it has Close(X) button????
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Close forms
Hi marcushe,
you can use the RanorexPath to get a list with all forms which have a close button in their titlebar:
Christian
Ranorex Support Team
you can use the RanorexPath to get a list with all forms which have a close button in their titlebar:
foreach(Ranorex.Form form in Host.Local.Find<Ranorex.Form>("/form/titlebar/button[@accessiblename='Close']/../../")) { if(form.Visible && form.Enabled /*..whatever...*/) { form.Close(); } }Regards,
Christian
Ranorex Support Team
Re: Close forms
Thanks , it's a easy way to identify forms.