I'm trying to get the image from a toolbar button with little success.
After quickly realising that it wasn't a property on the Ranorex.Button object/element, I thought about trying the remote invoke stuff again (like I did for the treeview). But I can't seem to cast the button objects to Ranorex.Control.
If i use .As<Ranorex.Control>() then the resulting control object is null
if I use the Ranorex.Control constructor, it throws a capability exception.
I don't want to have to just use the CaptureCompressedImage (which I assume just takes a screenshot of that image) as we will be running on multiple OS's and this will not be reliable enough.
Any ideas?
Thank
Chris
Button images from toolbar
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Button images from toolbar
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Button images from toolbar
You can only create a Ranorex.Control adapter from an element if the element supports the corresponding "Control" capability, i.e. if the "Control" capability is listed in the "General" tab in Ranorex Spy for that element. Please read the following chapter in the Ranorex User Guide for more info:
http://www.ranorex.com/support/user-gui ... apter.html
If your application is a .NET Windows Forms app, I bet that the parent of your toolbar button element has the Control capability. You can then call InvokeRemotely on that parent element and get the icon corresponding to the button.
And right, if you use the Imaging class or the CaptureCompressedImage method, you will get a screenshot of the element.
Regards,
Alex
Ranorex Support Team
http://www.ranorex.com/support/user-gui ... apter.html
If your application is a .NET Windows Forms app, I bet that the parent of your toolbar button element has the Control capability. You can then call InvokeRemotely on that parent element and get the icon corresponding to the button.
And right, if you use the Imaging class or the CaptureCompressedImage method, you will get a screenshot of the element.
Regards,
Alex
Ranorex Support Team
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: Button images from toolbar
Hi Alex,
So the application I'm trying to use is SqlServer management studio... and the parent of the button is either a Toolbar or Menubar, both I believe are MsoCommandBar objects, neither of which have the Control capability.
I'm assuming MsoCommandBar are Win32?? can these be cast to something that ranorex knows about to get more than just rudimentary control?
So the application I'm trying to use is SqlServer management studio... and the parent of the button is either a Toolbar or Menubar, both I believe are MsoCommandBar objects, neither of which have the Control capability.
I'm assuming MsoCommandBar are Win32?? can these be cast to something that ranorex knows about to get more than just rudimentary control?
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Button images from toolbar
InvokeRemotely only works with .NET Windows Forms controls, so that's not an option for pure Win32 windows.
Currently, there is no direct way in Ranorex to get the icons from MsoCommandBar toolbar buttons. And I doubt there will be a way in the near future, since the interface for this control is not open to the public. So, the only way right now is to use screenshots (Imaging class or CaptureCompressedImage method).
Regards,
Alex
Ranorex Support Team
Currently, there is no direct way in Ranorex to get the icons from MsoCommandBar toolbar buttons. And I doubt there will be a way in the near future, since the interface for this control is not open to the public. So, the only way right now is to use screenshots (Imaging class or CaptureCompressedImage method).
Regards,
Alex
Ranorex Support Team
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: Button images from toolbar
I suspected as much, but thanks anyway
. Our testers will have to do that manually... sigh! lol

Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge