C ++ Win32阻止上下文菜单关闭 [英] c++ win32 prevent context menu from closing

查看:84
本文介绍了C ++ Win32阻止上下文菜单关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想防止在Win32 C ++应用程序中关闭上下文菜单。我想防止在用户单击子菜单项时关闭子菜单。我必须实现/覆盖哪些信息?

I would like to prevent the context menu from being closed in my win32 c++ application. I want to prevent closing the submenu when user clicks on a submenu item. Which message do i have to implement/override?

推荐答案

一段时间内没有完成win32开发,但是我想到的只是一些随机想法-可能会有所帮助:

Haven't done win32 dev in a while, however just random thoughts that come to my mind - maybe will be helpful:

1)也许您可以在单击项目后立即尝试再次显示上下文菜单

1) maybe you could try to show the context menu again right after the item was clicked

2)或以复杂的方式进行操作-查找,然后对上下文菜单窗口进行子类化,然后拦截WM_CLOSE / WM_DESTROY消息

2) or do it the complex way - find, then subclass the context menu window, then intercept WM_CLOSE/WM_DESTROY messages

总体上,这似乎是一件很奇怪的事情。如果要在选择后将其保留在屏幕上,则菜单可能不是正确的UI元素。也许您需要一个无模式对话框?

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. Maybe you need a modeless dialog instead?

这篇关于C ++ Win32阻止上下文菜单关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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