| View previous topic :: View next topic |
| Author |
Message |
p.zott
Joined: 22 Jul 2006 Posts: 19
|
Posted: Fri Nov 16, 2007 12:15 am Post subject: Menus of the Windows Explorer in Vista |
|
I try to use the menus of the Windows Explorer in Vista but it does not work with the Menu class.
Can somebody suggest me an other way.
Peter |
|
| Back to top |
|
 |
Support Team Site Admin
Joined: 07 Jul 2006 Posts: 435
|
Posted: Mon Nov 19, 2007 1:30 am Post subject: |
|
The Menu of the Windows Explorer in Vista is a ToolBar and not a Menu control.
It has no Text and no ControlId so it's difficult to find.
Use the following code to automate the menus of the explorer:
Code: click into code to enlarge
Form form = Application.FindFormClassName("CabinetWClass");
form.Activate();
ToolBar toolbar = null;
// Find the toolbar with the commandId = 32896 (View menu item)
foreach (Control control in form.Controls)
{
if (control.ClassName == "ToolbarWindow32")
{
toolbar = new ToolBar(control.Handle);
if (toolbar.GetItemIndex(32896) > 0)
break;
else
toolbar = null;
}
}
if (toolbar != null)
{
toolbar.ClickItem(32896); // Click the View menu item
Application.PopupMenuSelectItem("Details");
}
Jenö
Ranorex Support Team |
|
| Back to top |
|
 |
p.zott
Joined: 22 Jul 2006 Posts: 19
|
Posted: Wed Dec 05, 2007 1:22 am Post subject: |
|
Thank you, this works fine.
Peter |
|
| Back to top |
|
 |
|