如何在vc ++中禁用和启用菜单项 [英] how to disable and enable menu items in vc++

查看:241
本文介绍了如何在vc ++中禁用和启用菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在mainframe.cpp&在正常的代码但它崩溃





i did following in mainframe.cpp & in normal code but it is crashing


CMenu *mmenu = GetMenu();
mmenu->EnableMenuItem(IDRMENUNAME,MF_BYPOSITION | MF_DISABLED | MF_GRAYED);

推荐答案

您正在使用菜单项ID IDRMENUNAME MF_BYPOSITION 这可能意味着索引超出范围。您也无法检查 GetMenu 是否返回有效指针。
You are using the menu item id IDRMENUNAME with MF_BYPOSITION which probably means that the index is out of range. You also fail to check that GetMenu returns a valid pointer.


这篇关于如何在vc ++中禁用和启用菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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