标签:处理程序 blog 菜单 右键菜单 cme tor int https bsp
参考:https://blog.csdn.net/q5512049/article/details/48159165
1. 定义成员变量 CMenu m_menu;
2. 添加消息WM_CREATE消息的函数,OnCreate函数中,
m_menu.CreatePopupMenu(); m_menu.AppendMenu(MF_STRING, IDM_ITEM0, L"拷贝"); m_menu.AppendMenu(MF_STRING, IDM_ITEM1, L"剪切"); m_menu.AppendMenu(MF_STRING, IDM_ITEM2, L"粘贴"); m_menu.AppendMenu(MF_SEPARATOR, IDM_ITEM3, L""); m_menu.AppendMenu(MF_STRING, IDM_ITEM4, L"全选"); m_menu.AppendMenu(MF_SEPARATOR, IDM_ITEM5, L""); m_menu.AppendMenu(MF_STRING, IDM_ITEM6, L"删除");
3. 类向导添加 WM_RBUTTONUP 的响应函数,并写
void CtestMenuDlg::OnRButtonUp(UINT nFlags, CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 //显示菜单 ClientToScreen(&point); m_menu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this, NULL); CDialogEx::OnRButtonUp(nFlags, point); }
标签:处理程序 blog 菜单 右键菜单 cme tor int https bsp
原文地址:https://www.cnblogs.com/htj10/p/12482846.html