有关快捷菜单的问题? 你应该处理 OnContextMenu()而不是OnRButtonDown() 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我试过的了,在OnContextMenu()中右击连快捷菜单都不能创建,要双击右键才行,又不知是何原因。 void CCWDeptTreeView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here UNREFERENCED_PARAMETER(pNMHDR); // TODO: Add your control notification handler code here CTreeCtrl& ctlTree = (CTreeCtrl&) GetTreeCtrl(); HTREEITEM itemTree; UINT nFlags; CPoint curPoint; GetCursorPos(&curPoint); ScreenToClient(&curPoint); itemTree= ctlTree.HitTest(curPoint, &nFlags); if (itemTree!=NULL) ctlTree.Select(itemTree,TVGN_CARET); CPoint posMouse; GetCursorPos(&posMouse); CMenu menu; menu.LoadMenu(IDR_CWDEPT_VIEW); menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, posMouse.x, posMouse.y ,::AfxGetMainWnd()); *pResult = 0;} VS2008 MFC 自绘按钮问题 关于CToolTipCtrl类的问题 请指点迷津,VC学到什么程度,才能出去找工作呢?? CFile类如何读入巨量的数据? 关于CreateDesktop 的问题 在Win32 Application下用API创建了一个窗口,如何在这个窗口上添加菜单? 求网友帮助: 大虾,请帮帮小弟!关于CTreeCtrl派生的问题 ¥¥¥¥¥¥¥¥¥¥ 有关坐标变换的一个问题 ¥¥¥¥¥¥¥¥¥¥ 一个关于宏定义的问题(30) 为什么创建主框架时,无菜单酒会出现创建空文档失败? sdk编程,如何让窗口不能接受WM_LBOTTUNDONW消息?
{
// TODO: Add your control notification handler code here
UNREFERENCED_PARAMETER(pNMHDR);
// TODO: Add your control notification handler code here
CTreeCtrl& ctlTree = (CTreeCtrl&) GetTreeCtrl();
HTREEITEM itemTree; UINT nFlags;
CPoint curPoint;
GetCursorPos(&curPoint);
ScreenToClient(&curPoint);
itemTree= ctlTree.HitTest(curPoint, &nFlags);
if (itemTree!=NULL)
ctlTree.Select(itemTree,TVGN_CARET);
CPoint posMouse;
GetCursorPos(&posMouse); CMenu menu;
menu.LoadMenu(IDR_CWDEPT_VIEW);
menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
posMouse.x, posMouse.y ,::AfxGetMainWnd()); *pResult = 0;
}