EVC下动态控制框架的主菜单的问题

letheanwater 2008-05-16 11:15:17
是这样的
我在MainFrame中装载了一个MenuBar,上面有五个菜单项
但是其中有两项我会不定期的使用。想在不使用的时候将其隐藏掉。
在VC下面可以使用GetMenu()->DeleteMenu(3, MF_BYPOSITION);这样的方式来实现
但是在EVC下面,菜单是不会弹出了,但是菜单文字还是留在主菜单上。
不知道各位大大有没有遇到过这样的问题呢。

如能解决,不胜感激呀。


问题描述:
我有一个菜单
项1 项2 项3 项4
子1 子1 子1 子1
子2 子2 子2 子2

使用了DeleteMenu方法后,就变成
项1 项2 项3 项4
子1 子1 子1
子2 子2 子2

这样了

项4 的文字还在主菜单上,很烦恼。多谢大家啦
...全文
122 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
letheanwater 2008-05-16
  • 打赏
  • 举报
回复
to: xiaohf702 肖海峰

我已经用了DeleteMenu
菜单也已经删除掉了,但是主菜单上的那个文字还在的。只是子菜单点不出来了。
letheanwater 2008-05-16
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 lenux 的回复:]
菜单我也很头疼。

我一般都是使用多个菜单,然后需要哪个是显示哪个。

你的问题是不是需要更新一下主菜单啊。
[/Quote]


对的,我需要更新一下主菜单
因为我有一半的菜单项是共用的,如果建多个菜单的话
消息维护也是比较麻烦的。
头疼死了。
xiaohf702 2008-05-16
  • 打赏
  • 举报
回复
EVC下好像也有个DeleteMenu,试试这个看看
BOOL DeleteMenu(
HMENU hMenu,
UINT uPosition,
UINT uFlags
);
Parameters
hMenu
[in] Handle to the menu to be changed.
uPosition
[in] Specifies the menu item to be deleted, as determined by the uFlags parameter.
uFlags
[in] Specifies how the uPosition parameter is interpreted. This parameter must be one of the following values. Value Description
MF_BYCOMMAND Indicates that uPosition gives the identifier of the menu item. The MF_BYCOMMAND flag is the default flag if neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified.
MF_BYPOSITION Indicates that uPosition gives the zero-based relative position of the menu item.

Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks
The application must call the DrawMenuBar function whenever a menu changes, whether or not the menu is in a displayed window.

Requirements
OS Versions: Windows CE 1.0 and later.
Header: Winuser.h.
Link Library: Menu.lib.

lenux 2008-05-16
  • 打赏
  • 举报
回复
菜单我也很头疼。

我一般都是使用多个菜单,然后需要哪个是显示哪个。

你的问题是不是需要更新一下主菜单啊。
letheanwater 2008-05-16
  • 打赏
  • 举报
回复
呵呵,采用lenux 的办法解决问题。

同时感谢楼上的回复
这个方法在VC下可用,在EVC下不能用的。
:)
KevinCEC 2008-05-16
  • 打赏
  • 举报
回复
删除之后,添加
GetMenu()->DrawMenuBar()

试试看
lenux 2008-05-16
  • 打赏
  • 举报
回复
多个菜单中的公用项可以使用相同ID。消息维护就没有问题了

19,502

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧