CListCtrl控件右键弹出菜单响应函数在运行时出错,没有弹出菜单.
void CRuleLibraryCreatorDlg::OnRclickImportedFileList(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
NM_LISTVIEW* pNMListView=(NM_LISTVIEW*)pNMHDR;
if(pNMListView->iItem!=-1)
{
//获取鼠标指针位置
CPoint Pos;
GetCursorPos(&Pos);
//加载菜单资源
CMenu menu;
VERIFY( menu.LoadMenu( IDR_RIGHTCLICK_ON_FILELIST_MENU) );
CMenu* popup = menu.GetSubMenu(0);
ASSERT( popup == NULL );
CWnd* pWnd = GetDlgItem(IDC_IMPORTED_FILE_LIST);
ASSERT(pWnd == NULL);
popup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, Pos.x, Pos.y, pWnd);
}
------解决方法--------------------------------------------------------
popup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, Pos.x, Pos.y, this);
------解决方法--------------------------------------------------------
ASSERT( popup == NULL );
ASSERT(pWnd == NULL);
调试会报错吧。。