c++ win32 prevent context menu from closing

杀马特。学长 韩版系。学妹 提交于 2020-06-26 04:15:11

问题


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?


回答1:


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

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

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

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?




回答2:


Please see the following article.



来源:https://stackoverflow.com/questions/7570918/c-win32-prevent-context-menu-from-closing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!