拥有菜单(HMENU)的菜单,是否可以找到其父窗口(HWND)? [英] having handle to a menu (HMENU) is it possible to find it's parent window (HWND)?

查看:186
本文介绍了拥有菜单(HMENU)的菜单,是否可以找到其父窗口(HWND)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道系统菜单的选项,即alt + space.这还不是很漂亮,它涉及通过GetNextWindow循环所有打开的窗口.但我想以更一般的方式提出.那具有任何菜单句柄,而不必指向系统菜单(对于任何窗口都容易找到),是否有可能到达其父窗口?

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 ?

推荐答案

在特殊情况下,从现有菜单窗口(类#32768)动态获取hmenu时: 您可以通过GetGUIThreadInfo(GetWindowThreadProcessId)使用GUITHREADINFO.hwndMenuOwner. 即时"表示:在WindowFromPoint之后,通过SendMessageTimeout(MN_GETHMENU)或通过GetMenuBarInfo(OBJID_CLIENT).

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.

这篇关于拥有菜单(HMENU)的菜单,是否可以找到其父窗口(HWND)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆