Ranorex

Menus of the Windows Explorer in Vista

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
p.zott



Joined: 22 Jul 2006
Posts: 19

PostPosted: 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
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 435

PostPosted: 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
View user's profile Send private message Visit poster's website
p.zott



Joined: 22 Jul 2006
Posts: 19

PostPosted: Wed Dec 05, 2007 1:22 am    Post subject:
Thank you, this works fine.

Peter
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum