Page 1 of 1
mainmenu control not found
Posted: Mon Oct 09, 2006 12:10 pm
by khalifa_ah
hi
i use Ranorex to test GUI of Application Made by Visual Studio.NET 2003 , and i want to work with main menu control , i try menustrip as : MenuStrip menuStrip = form.FindMenuStrip("mmnMain"); but it always return null and i didn't found any control in Ranorex name MainMenu.
i will be so happy if you can help me.
thanks
bye
Posted: Mon Oct 09, 2006 8:34 pm
by webops
The classes MenuStrip, ToolStrip and StatusStrip are new in Visual Studio 2005 and does not exist in Visual Studio 2003.
(We extended the RanorexNet documentation with this information for the next version.)
Visual Studio 2003 applications have an old style menu bar with menu handle, not a menu strip.
You can automate such a menu as follows:
Code: Select all
Menu menu = new Menu(form);
if (menu != null)
{
// Get the item count of the first submenu
ret = menu.GetItemCount(1);
Console.WriteLine(" GetItemCount(1)={0}", ret);
// Get the text of the second menu item of the first submenu
itemText = menu.GetItemText(1, 2);
Console.WriteLine(" GetItemText(1,2)={0}", itemText);
// Select a menu item
ret = menu.SelectItemText("Submenu2", "Submenu2Item1");
}
The following code sample dumps out all menu item of the submenu 1 and 2.
Code: Select all
for (int submenu = 1; submenu <= 2; submenu++)
{
Int32 itemCount = menu.GetItemCount(submenu);
for (int itemPosition = 1; itemPosition <= itemCount; itemPosition++)
{
itemText = menu.GetItemText(submenu, itemPosition);
Console.WriteLine(" Item({0})={1}", itemPosition, itemText);
}
}
Jenö Herget
Ranorex Team
Posted: Tue Oct 10, 2006 7:23 am
by khalifa_ah
thanks for your reply , really your reply is very useful for me.
thanks again.
bye