Page 1 of 1

How do I get the parent form of a #32770 form?

Posted: Thu Jul 14, 2011 10:30 pm
by Aracknid
In my older automation app, I was using a Windows API command 'GetParent', passing in the handle of the #32770 window, getting back the handle of the parent window. So usually this was the IE window in my testing.

Is there a way using Ranorex API to get the parent?

If not, I guess I continue to use the Windos API, and if so is there an easy way to do this exposed by Ranorex?

Thanks,

Aracknid

Re: How do I get the parent form of a #32770 form?

Posted: Thu Jul 14, 2011 11:14 pm
by Ciege
Do you have a valid Ranorex element?
If so you can use MyElement.Element.Parent to get the parent.

Re: How do I get the parent form of a #32770 form?

Posted: Thu Jul 14, 2011 11:34 pm
by Aracknid
The IE message boxes are shown at the top level of the Spy Tree. Will they have a parent if I use your proposed way?

Re: How do I get the parent form of a #32770 form?

Posted: Thu Jul 14, 2011 11:37 pm
by Ciege
Well, if Spy shows that they have no parent then... No, no method will give you the parent since there is none...

Re: How do I get the parent form of a #32770 form?

Posted: Fri Jul 15, 2011 7:32 pm
by Aracknid
I tied to do as you suggested, but it returns the handle of the Host (top of Spy tree).

Instead I added a reference Windows user32.dll and called the function GetParent and it returned the IE Form handle that spawned the #32770 window.

Just as an FYI, I need to know which IE form spawned the #32770 window so I can ensure I'm working with the popup of the IE form I'm testing within instead of another IE form that could be open that popped up its own #32770 window.

Aracknid