Please tell the code to access a menu item

Class library usage, coding and language questions.
deepa
Posts: 1
Joined: Tue Sep 19, 2006 6:27 am

Please tell the code to access a menu item

Post by deepa » Tue Sep 19, 2006 6:35 am

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

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Thu Sep 21, 2006 12:15 am

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