在OnContextMenu中我这样判断,为何不起作用?
HTREEITEM hItem = NULL;
UINT uFlags;
hItem = m_tree.HitTest(point,&uFlags);
//判断鼠标是否点到了TREE的ITEM上面
if (hItem == NULL)
{
MessageBox("not tree");
}
else
{
GetCursorPos(&point);
CPoint mouse = point;
CMenu menu;
menu.LoadMenu(IDR_MENU1);
CMenu* pSubMenu = NULL;
pSubMenu = menu.GetSubMenu(0);
//::TrackPopupMenu(pSubMenu->m_hMenu, TPM_LEFTALIGN , mouse.x, mouse.y, 0,m_hWnd, NULL);
pSubMenu->TrackPopupMenu(TPM_RIGHTBUTTON, mouse.x, mouse.y, this );
pSubMenu -> DestroyMenu();
}