Page 1 of 1

Menus of the Windows Explorer in Vista

Posted: Thu Nov 15, 2007 11:15 pm
by p.zott
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

Posted: Mon Nov 19, 2007 12:30 am
by Support Team
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: Select all

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

Posted: Wed Dec 05, 2007 12:22 am
by p.zott
Thank you, this works fine.

Peter