So if I have a handle to a menu does anyone know how to figure out if
the menu is a submenu & what if it is, what its parent is.
Use GetMenuItemInfo to get the information about the menu item to test.
If the menu has a parent, i.e. is part of a sub menu, then the wID parameter
in the MENUITEMINFO data returned from GetMenuItemInfo will be the
parent menu handle and not a command ID. To test if wID is a menu handle,
use
IsMenu.
Best regards,
Barry S. Kyker
...on the other hand, there's no (official) way to find out which
*window* owns the menu. If the menu is of your creation, you can
store the HWND e.g. using SetMenuInfo->MENUINFO.dwMenuData; otherwise,
you're stuck.
--
Jugoslav
___________
www.geocities.com/jdujic
Please reply to the newsgroup.
You can find my real e-mail on my home page above.
"Barry S. Kyker" <bsk...@bellsouth.net> wrote in message
>
> Use GetMenuItemInfo to get the information about the menu item to test.
> If the menu has a parent, i.e. is part of a sub menu, then the wID parameter
> in the MENUITEMINFO data returned from GetMenuItemInfo will be the
> parent menu handle and not a command ID. To test if wID is a menu handle,
> use
> IsMenu.
>
>
> Best regards,
>
> Barry S. Kyker
[1](not what I want to write)
When using API functions AppendMenu and InsertMenu in the days
when these functions weren't obsolete, to insert a menu item you used
the id that will be returned when a WM_COMMAND message is
received. If you wanted to insert a submenu, you create a new menu
using CreateMenu. Then to insert the submenu into the parent, you
called AppendMenu or InsertMenu and used the handle to the newly
created menu instead of an id.
I don't think that he is trying to find the window that owns the
menu item, just the parent menu that owns the menu in question.
If you wanted to find which window owned the submenu item,
you could use the above method to get to the top menu item, i.e.
the menu that does not have a parent, and then compare the handle
of the top menu item with the handle returned from GetMenu for all
of the window associated with the application.
--
For the answer below I was hoping for a general method to discover
this kind of datum ....
Thanks A LOT for your answer, though.
Upon further searching some answers on Google I had ignored earlier
because they dealt with VB turn out to contain this answer too.
"Barry S. Kyker" <bsk...@bellsouth.net> wrote in
messagnews:<7xnic.4065$oN1....@bignews5.bellsouth.net>...
> Sam" <9mo9...@sneakemail.com> wrote in message
> news:2b04d5d.04042...@posting.google.com...
> > WHERE THE HECK[1]did you uncover this little tidbit?
> >
>