RightClick on CListCtrl and application hangs if clicked out of application  
Author Message
manishjain9





PostPosted: Visual C++ General, RightClick on CListCtrl and application hangs if clicked out of application Top

i am using a list on a child dialog which is a CListCtrl object.

If i RightClick on that list and click out of application, the application hangs and does not respond.

the message is 135 on which it hangs..

It works well if i am in the application.

how can i solve this

the right click code sample is here:

void CScanWizard2Dlg::OnNMRclickList(NMHDR *pNMHDR, LRESULT *pResult)

{

//*pResult = 0;

//get selected item

POSITION pos = m_listCategories.GetFirstSelectedItemPosition();

if (pos)

{

CMenu menu;

//load context menu

VERIFY(menu.LoadMenu(IDR_MENU_SELECT));

CMenu* pPopup = menu.GetSubMenu(0);

ASSERT(pPopup != NULL);

POINT point;

::GetCursorPos(&point);

TrackPopupMenu(pPopup->m_hMenu, 0, point.x, point.y, 0,GetSafeHwnd(),CRect(0,0,0,0)); //use command bars to show popup menu

menu.DestroyMenu();

}

}




Visual C++13  
 
 
Damien Watkins - MSFT





PostPosted: Visual C++ General, RightClick on CListCtrl and application hangs if clicked out of application Top

Hello

Re: RightClick on CListCtrl and application hangs if clicked out of application

The more appropriate place for your question is probably the MFC newsgroup: http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.vc.mfc&lang=en&cr=US

Thanks

Damien