Popupmenu doesn't work with .NET 1.1 context menu

Nov 22, 2008 at 7:34 PM

I'm trying to automate menus in a .NET 1.1 application. The PopupMenu method never finds my menu.

But, if I recompile the app with .NET 2.0 and change the context menu by a ContextMenuStrip it works.

Problem is I need to automate the 1.1 application.

Do you know how to fix it?


Nov 23, 2008 at 12:06 AM
Ok, inspecting with UISpy it seems these menus are "linked" to the desktop so the following code (which can be improved!!) will make it:


public object GetMenu()




AutomationElementCollection col = Desktop.Instance.AutomationElement.FindAll(TreeScope.Children, Condition.TrueCondition);






foreach (AutomationElement el in col)







if (el.Current.ControlType == ControlType.Menu)




return new Core.UIItems.MenuItems.PopUpMenu(el, Desktop.Instance.ActionListener);





return null;



Nov 25, 2008 at 2:42 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.