Hiya Ranorex,
I identify a control in ranorex spy. I see lots of nice properties...
I then check the API ... where are these properties?!
Why isnt your API developed so each adapter class exposes its properties as PROPERTIES, and enumerated strings as an enumerated types instead!
Anyway for my question....
I have a Form object, the form could be Win32, WinForms or WPF ... all I want is the native window handle
How can I do that ?
Thanks
Clayton
Adapters & Elements
Re: Adapters & Elements
All the juicy details are located in the Element of the adapter (myAdapter.Element).
To get the window handle:
Ranorex.Form frm = @"RxPath to a form";
IntPtr hWnd = (IntPtr) frm.Element.GetAttributeValue("Handle");
To get the window handle:
Ranorex.Form frm = @"RxPath to a form";
IntPtr hWnd = (IntPtr) frm.Element.GetAttributeValue("Handle");
Re: Adapters & Elements
will that work for WPF windows?
Re: Adapters & Elements
It should. I just did a test with a sample WPF application, and it returned a proper Window Handle.
Re: Adapters & Elements
cheers!
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Adapters & Elements
Just a follow-up on this post as it has been linked to recently by another post:
Check out the corresponding topic in the Ranorex User Guide:
http://www.ranorex.com/support/user-gui ... apter.html
Alex
Ranorex Team
Actually, the API is and was always designed that wayatom wrote:Why isnt your API developed so each adapter class exposes its properties as PROPERTIES, and enumerated strings as an enumerated types instead!

http://www.ranorex.com/support/user-gui ... apter.html
Not all forms have a window handle depending on their technology, only those supporting the "NativeWindow" capability/adapter. To get the window handle from a Win32 form, you can use following code:atom wrote:I have a Form object, the form could be Win32, WinForms or WPF ... all I want is the native window handle
Ranorex.Form form = ...; // your code to get the form Ranorex.NativeWindow window = new Ranorex.NativeWindow(form); IntPtr handle = window.Handle;Regards,
Alex
Ranorex Team