如何给动态创建的Popup菜单的菜单项添加图标?

chenjinming 2008-02-05 01:42:46
如题,菜单是动态创建的:
for(vsi it=m_shortcut.begin();it!=m_shortcut.end();it++)
{
ASSERT(bitmap.m_hObject!=NULL);
submenuShortcut.AppendMenu(MF_STRING,(UINT)((*it)->GetID()) , (*it)->GetAppName());
}
...全文
105 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Yao-debo 2008-02-08
  • 打赏
  • 举报
回复
建议:还是自己写菜单类比较好,以后也用得到;
cnzdgs 2008-02-05
  • 打赏
  • 举报
回复
每个要加图标的菜单项都要执行此函数来设置。一下内容摘自MSDN。
SetMenuItemInfo Function

--------------------------------------------------------------------------------

The SetMenuItemInfo function changes information about a menu item.

Syntax

BOOL SetMenuItemInfo( HMENU hMenu,
UINT uItem,
BOOL fByPosition,
LPMENUITEMINFO lpmii
);
Parameters

hMenu
[in] Handle to the menu that contains the menu item.
uItem
[in] Identifier or position of the menu item to change. The meaning of this parameter depends on the value of fByPosition.
fByPosition
[in] Value specifying the meaning of uItem. If this parameter is FALSE, uItem is a menu item identifier. Otherwise, it is a menu item position.
lpmii
[in] Pointer to a MENUITEMINFO structure that contains information about the menu item and specifies which menu item attributes to change.
Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, use the GetLastError function.
chenjinming 2008-02-05
  • 打赏
  • 举报
回复
能具体一点吗?谢谢!
cnzdgs 2008-02-05
  • 打赏
  • 举报
回复
用SetMenuItemInfo

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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