Hi
I'm trying to recognize a VB6 OCX Control within a VB6 application using Ranorex 5.1.2.
The most of the objects within the VB6 application is recognized fine, but this OCX control from Janusys.com called GrixEx2000b is only recognized as a nativewindow. It's a rather complex control with a lot of functionalites an different views. The control can render views as different panes like in Microsoft Outlook.
I've attached a few screenshots of the behavior of Ranorex trying to recognize the objects.
What is the best way of using Ranorex automating this control?
Is there a way of hooking into the OCX control, we have a license for the GrixEx2000b control, with could enable us to publish it's COM interface as the way of controlling the control.
It's a rather big project that we are testing and will last for the next four years with a budget quite big, so we are willing to startup an even closer coorporation to get this to work.
Best regards
Jakob Øjvind Nielsen
Unable to recognize objects within VB6 OCX control
-
- Posts: 3
- Joined: Thu Feb 05, 2015 1:27 pm
Unable to recognize objects within VB6 OCX control
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Unable to recognize objects within VB6 OCX control
Hello Jakob,
In order to identify objects Ranorex needs implemented accessibility. Often custom 3rd party controls are not built with accessibility in mind. As a workaround you can implement accessibility for these objects on your own. For further information, please visit our blog: Enabling Automation
Regards,
Robert
In order to identify objects Ranorex needs implemented accessibility. Often custom 3rd party controls are not built with accessibility in mind. As a workaround you can implement accessibility for these objects on your own. For further information, please visit our blog: Enabling Automation
Regards,
Robert
-
- Posts: 3
- Joined: Thu Feb 05, 2015 1:27 pm
Re: Unable to recognize objects within VB6 OCX control
Hi Robert
Thanks for your reply.
As I have understood by reading the article, that I need to develop an accessibility layer with a reference to the third party control, so that the third party control is recognizable. That fine.
But now I have my application which used the GridEx control, this application it self will not be using my accessibility layer, but Ranorex will at some point. This "at some point", how do I tell Ranorex that my new accessibility layer is available and Ranorex should use it while trying to recognize the GridEx control within the VB6 application?
Best regards
Jakob Øjvind Nielsen
Thanks for your reply.
As I have understood by reading the article, that I need to develop an accessibility layer with a reference to the third party control, so that the third party control is recognizable. That fine.
But now I have my application which used the GridEx control, this application it self will not be using my accessibility layer, but Ranorex will at some point. This "at some point", how do I tell Ranorex that my new accessibility layer is available and Ranorex should use it while trying to recognize the GridEx control within the VB6 application?
Best regards
Jakob Øjvind Nielsen
Last edited by jakobojvind on Mon Feb 16, 2015 9:17 am, edited 1 time in total.
-
- Posts: 3
- Joined: Thu Feb 05, 2015 1:27 pm
Re: Unable to recognize objects within VB6 OCX control
Hi Robert
The example you referring to are using the TreeViewAdv which a .Net control derived from System.Windows.Form.Control. This give the TreeViewAdv the possibility to override the AccessibleObject CreateIAccessibilityInstance().
But in the case of GrixEx, this control is purely a OCX Control for VB6, not derived from System.Windows.Form.Control. Therefor this control isn't implementing the AccessibleObject at all, and therefore not giving us the possibility to implement the CreateIAccessibilityInstance().
As example I use this
This will though give us the following errors:
I could choose trying to inherit the partial GrixEx from : Control
like
I gave it another try and made this, which didn't gave any errors, but is it the correct way of implementing it and how do I use it in Ranorex? Because at some point I need to pair the control in my VB6 application with the class written here below. I'm puzzled...
Best regards
Jakob Øjvind Nielsen
The example you referring to are using the TreeViewAdv which a .Net control derived from System.Windows.Form.Control. This give the TreeViewAdv the possibility to override the AccessibleObject CreateIAccessibilityInstance().
But in the case of GrixEx, this control is purely a OCX Control for VB6, not derived from System.Windows.Form.Control. Therefor this control isn't implementing the AccessibleObject at all, and therefore not giving us the possibility to implement the CreateIAccessibilityInstance().
As example I use this
using System; using GridEX20; using System.Windows.Forms; namespace GridEX20 { public partial class GridEX { protected override AccessibleObject CreateAccessibilityInstance() { return base.CreateAccessibilityInstance(); } public class GridExAccessibleObject : Control.ControlAccessibleObject { private GridEX gridEx; public GridExAccessibleObject(GridEX owner) : base(owner) { } } } }
This will though give us the following errors:
Code: Select all
Error 1 'GridEX20.GridEX.CreateAccessibilityInstance()': no suitable method found to override E:\kode\DN\experiments\GrixEx\MSAATest\GrixExAccessibleObject\GridEX.cs 9 45 Testware.AccessibleObjects
Error 2 'object' does not contain a definition for 'CreateAccessibilityInstance' E:\kode\DN\experiments\GrixEx\MSAATest\GrixExAccessibleObject\GridEX.cs 11 25 Testware.AccessibleObjects
Error 6 Argument 1: cannot convert from 'GridEX20.GridEX' to 'System.Windows.Forms.Control' E:\kode\DN\experiments\GrixEx\MSAATest\GrixExAccessibleObject\GridEX.cs 19 22 Testware.AccessibleObjects
Error 5 The best overloaded method match for 'System.Windows.Forms.Control.ControlAccessibleObject.ControlAccessibleObject(System.Windows.Forms.Control)' has some invalid arguments E:\kode\DN\experiments\GrixEx\MSAATest\GrixExAccessibleObject\GridEX.cs 19 17 Testware.AccessibleObjects
like
public partial class GridEX : Controlbut this will in return give us these warnings:
Code: Select all
Warning 4 The type 'GridEX20.GridEX' in 'E:\kode\DN\experiments\GrixEx\MSAATest\GrixExAccessibleObject\GridEX.cs' conflicts with the imported type 'GridEX20.GridEX' in 'E:\kode\DN\experiments\GrixEx\MSAATest\GrixExAccessibleObject\obj\Debug\Interop.GridEX20.dll'. Using the type defined in 'E:\kode\DN\experiments\GrixEx\MSAATest\GrixExAccessibleObject\GridEX.cs'. E:\kode\DN\experiments\GrixEx\MSAATest\GrixExAccessibleObject\GridEX.cs 16 21 Testware.AccessibleObjects
I gave it another try and made this, which didn't gave any errors, but is it the correct way of implementing it and how do I use it in Ranorex? Because at some point I need to pair the control in my VB6 application with the class written here below. I'm puzzled...
using System; using GridEX20; using System.Runtime.InteropServices; using Accessibility; using System.Windows.Forms; namespace Testware.AccessibleObjects { public partial class GrixEx { public class GridExAccessibleObject: AccessibleObject { GridEX20.GridEX owner; public GridExAccessibleObject(GridEX20.GridEX owner) : base() { base.Name = "GridExAccessibleObject"; } public override string Description { get { return "GridExAccessibleObject in action"; } } } } }So bottom line, how do we implement MSAA on top of an old school VB6 OCX Control that doesn't act an accessibility server?
Best regards
Jakob Øjvind Nielsen
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Unable to recognize objects within VB6 OCX control
Hello Jakob,
Regards,
Robert
It will be a tedious task to implement MSAA for your VB6 control. Please find a comprehensive sample related to MSAA implementation here: http://www.codeproject.com/Articles/182 ... essibilitySo bottom line, how do we implement MSAA on top of an old school VB6 OCX Control that doesn't act an accessibility server?
Regards,
Robert
-
- Posts: 2
- Joined: Sat Feb 20, 2016 12:34 pm
Re: Unable to recognize objects within VB6 OCX control
I am trying to support the IAccessible interface on a VB6 control.
I have created an Active X component in C++ and implemented the interface IAccessible. The VB6 control creates an instance of my C++ helper object and passes its name and window handle into that object. The C++ object subclasses the window and returns the IAccessible interface in response to the WM_GETOBJECT message.
When I use the Track function in the Ranorex spy, it is fetching the interface and calling some methods on the interface, for example get_accName. On the face of it, it is working like clockwork, but it isn't.
Although Ranorex seems to be calling my IAccessible interface, it does not display any information from it.
In the Advanced tab, it does not show any "dynamic" properties for the UserControl.
It there any additional trick that I require to make Ranorex use the properties from the IAccessible interface?
I would be happy to share my code if it helps.
Phil
I have created an Active X component in C++ and implemented the interface IAccessible. The VB6 control creates an instance of my C++ helper object and passes its name and window handle into that object. The C++ object subclasses the window and returns the IAccessible interface in response to the WM_GETOBJECT message.
When I use the Track function in the Ranorex spy, it is fetching the interface and calling some methods on the interface, for example get_accName. On the face of it, it is working like clockwork, but it isn't.
Although Ranorex seems to be calling my IAccessible interface, it does not display any information from it.
In the Advanced tab, it does not show any "dynamic" properties for the UserControl.
It there any additional trick that I require to make Ranorex use the properties from the IAccessible interface?
I would be happy to share my code if it helps.
Phil
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Unable to recognize objects within VB6 OCX control
Hello Phil,
Unfortunately, I’m afraid that it’s not possible for us to review your code, since it would require too much time and diverges from our supported field.
Anyhow, I would suggest disabling the following MSAA filter: Hope this information helps.
Sincerely,
Robert
Unfortunately, I’m afraid that it’s not possible for us to review your code, since it would require too much time and diverges from our supported field.
Anyhow, I would suggest disabling the following MSAA filter: Hope this information helps.
Sincerely,
Robert
You do not have the required permissions to view the files attached to this post.
-
- Posts: 2
- Joined: Sat Feb 20, 2016 12:34 pm
Re: Unable to recognize objects within VB6 OCX control
Firstly, thanks for the tip. I will try the effect of that option.
Secondly, I was blind. My implementation of IAccessible was in fact being recognized by Ranorex, but the Ranorex Spy shows the elements twice. It shows one element with the name ThunderRT6UserControlDC, as previously, and another element representing the same window at the same level in the tree.
The track button finds the original element, so I didn't notice the new ones.
This is a cosmetic error, but I don't think it will prevent us from creating tests referring to these elements.
My guess is that it might work better, if I build a complete tree of objects supporting IAccessible for the whole UI. Since this is very old legacy code, I don't want to put in too much effort . At present I have handled only a custom button control and the main menu.
I still have to sit down with our testing guys to see if they can use it, but I am actually pretty confident that I have a working solution.
Secondly, I was blind. My implementation of IAccessible was in fact being recognized by Ranorex, but the Ranorex Spy shows the elements twice. It shows one element with the name ThunderRT6UserControlDC, as previously, and another element representing the same window at the same level in the tree.
The track button finds the original element, so I didn't notice the new ones.
This is a cosmetic error, but I don't think it will prevent us from creating tests referring to these elements.
My guess is that it might work better, if I build a complete tree of objects supporting IAccessible for the whole UI. Since this is very old legacy code, I don't want to put in too much effort . At present I have handled only a custom button control and the main menu.
I still have to sit down with our testing guys to see if they can use it, but I am actually pretty confident that I have a working solution.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Unable to recognize objects within VB6 OCX control
Hi Phil,
I'm glad that you found a solution.
Sincerely,
Robert
I'm glad that you found a solution.
Sincerely,
Robert