简体   繁体   English

c++ win32防止上下文菜单关闭

[英]c++ win32 prevent context menu from closing

I would like to prevent the context menu from being closed in my win32 c++ application.我想防止在我的 win32 C++ 应用程序中关闭上下文菜单。 I want to prevent closing the submenu when user clicks on a submenu item.当用户单击子菜单项时,我想防止关闭子菜单。 Which message do i have to implement/override?我必须实施/覆盖哪条消息?

请参阅以下文章

Haven't done win32 dev in a while, however just random thoughts that come to my mind - maybe will be helpful:有一段时间没有完成 win32 dev 了,但是我想到的只是一些随机的想法——也许会有所帮助:

1) maybe you could try to show the context menu again right after the item was clicked 1)也许您可以尝试在单击该项目后立即再次显示上下文菜单

2) or do it the complex way - find, then subclass the context menu window, then intercept WM_CLOSE/WM_DESTROY messages 2)或以复杂的方式进行 - 查找,然后将上下文菜单窗口子类化,然后拦截 WM_CLOSE/WM_DESTROY 消息

Overall this seems to be a weird thing to want to implement.总的来说,这似乎是一件想要实施的奇怪事情。 Maybe the menu is not the right UI element if you want to keep it on the screen after the selection was made.如果您想在进行选择后将其保留在屏幕上,则菜单可能不是正确的 UI 元素。 Maybe you need a modeless dialog instead?也许你需要一个无模式对话框?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM