Page 1 of 1

Please tell the code to access a menu item

Posted: Tue Sep 19, 2006 6:35 am
by deepa
I am using VC++ to test my application but I am not able to capture the menu bar,I tried givining the handle of main window of my application,Also I tried giving the control name that I captured using Ranorexspy.Please help its urgent :( ...I need to test access all the menu items

Posted: Thu Sep 21, 2006 12:15 am
by webops
If your menu bar has a control name, than it's a menü strip (like in the RanorexVS2005Sample).
You can find and use a menu strip in C++ as follows:

Code: Select all

HWND menuStrip = RxFormFindChildControlName(form, "menuStrip1");
if ( menuStrip == 0)
{
    printf(" ERROR: MenuStrip not found\n");
    exit(2);
}

printf(" menuStrip=%d\n", menuStrip);

RxMouseMoveToControl(menuStrip);

ret = RxMenuSelectPosition(menuStrip, 1, 1);
...
ret = RxMenuSelectPosition(menuStrip, 2, 3, 2);
...
ret = RxMenuSelectItemText(form, "Submenu1", "Submenu1Item3", "Subitem2");	
Jenö Herget
Ranorex Team