How to get menu bar handle? |
Post Reply |
Author | |
arty
Newbie Joined: 28 November 2008 Location: Belarus Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 28 November 2008 at 9:11am |
Oleg, please could you help me. I have a task to emulate a call of menu item (in dynamic menu) in third-party application which uses codejock toolkit. I’m a newbie at C++ but here is my plan. With help of Spy++ I found out that I can SendMessage to the main window with WM_COMMAND and wID. And it works! But at the moment I can’t get a wID (for testing I used wID from Spy). So then I used EnumChildWindows for getting all controls and tried to get menu handle with GetMenu…
Remarks from MSDN: GetMenu does not work on floating menu bars. Floating menu bars are custom controls that mimic standard menus; they are not menus. To get the handle on a floating menu bar, use the Active Accessibility APIs. and AccessibleObjectFromWindow. But every time I’ve received null. Is there another way to do that? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
HI,
Its not that easy :( our Menus have no HMENU handles. But indeed can try Accessibility feature that we support. You have call AccessibleObjectFromWindow for Menu window - see it in Spy++ - its window with XTPToolBar class.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
arty
Newbie Joined: 28 November 2008 Location: Belarus Status: Offline Points: 2 |
Post Options
Thanks(0)
|
BOOL CALLBACK // callback for EnumChildWindows
EnumChildProc(HWND hwnd, LPARAM lParam) { IDispatch** ppMenu; AccessibleObjectFromWindow(hwnd, OBJID_NATIVEOM, IID_IDispatch, (void**) ppMenu); // ppMenu is always null (even when hwnd=000103BE) return TRUE; } Here is code I use to get menu. As you see AccessibleObjectFromWindow is called for every child in window. I tried to insert OBJID_MENU instead of OBJID_NATIVEOM like dwObjectID parameter and IID_IAccessible instead of IID_IDispatch, but result is “te je yaica, vid sboku”. Window with handle 000103B0 is main window. Window with handle 000103BE is my menu I need to get access. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
I see it has class name "Afx:004..." it means it _very_ old version that didn't support accesibility :-(
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
pad_32
Newbie Joined: 02 December 2008 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Hi,
One of our client application is using Xtreme command bars. Its version is 8.7.0.0 . Is there any method to know the menu item status (Disable/Enable) programmatically from another application
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |