Reputation: 29377
I know about the option for system menu, that is the alt+space one. And it's not pretty it involves looping all open windows through GetNextWindow
. But I want to ask in more general way. That is having any menu handle, not necessarily to system menu (that is easy to find for any window) is it possible to get to its parent window ?
Upvotes: 1
Views: 2157
Reputation: 736
In the particular case when hmenu obtained on the fly from an existing menu-window (class #32768): you can use GUITHREADINFO.hwndMenuOwner via GetGUIThreadInfo(GetWindowThreadProcessId). "On the fly" means: via SendMessageTimeout(MN_GETHMENU) or via GetMenuBarInfo(OBJID_CLIENT), after WindowFromPoint.
Upvotes: 4
Reputation: 13932
No. Menus can be shared across windows, so there's no unique mapping from menus to windows.
Upvotes: 4