我在一个DialogBar中放了一个CTabCtrl上面放了一个CTreeCtrl
并在TreeCtrl的右键单击消息中弹出了右键菜单,可是菜单的命令响应消息不能响应,我加在视图和主框架中都不能响应,这是怎么回事啊,该如何响应啊!
代码如下:
void CTreeCtrlEx::OnRclick(NMHDR* pNMHDR, LRESULT* pResult) 
{
// TODO: Add your control notification handler code here
// MessageBox("asdfds");
UINT nFlags;
CPoint point;
CMenu Menu;
GetCursorPos(&point);
CPoint PointInTree = point;
ScreenToClient( &PointInTree);

HTREEITEM m_hCurrentItem=HitTest(PointInTree,&nFlags);//±£´æÓÒ¼üµ¥»÷λÖÃĿ¼Ê÷ÏîµÄ¾ä±ú
if ( m_hCurrentItem != NULL)
{
SelectItem(m_hCurrentItem);//ÉèÖÃΪµ±Ç°Ïî
}

if (Menu.LoadMenu(IDR_MENU1))
{
CMenu* pSubMenu = Menu.GetSubMenu(0);
if (pSubMenu!=NULL)
{
pSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,point.x,point.y,this);
}
}
*pResult = 0;
}void CChildView::OnTest() //根本就不指向这个函数啊
{
// TODO: Add your command handler code here
MessageBox("asdf");
}