Hello,A difficulty question about listbox
when I click one list box item,the item is changed the color,then I right click the mouse,I would like to show a Dialog,how can I do?
# 1 Re: Hello,A difficulty question about listbox
when I click one list box item,the item is changed the color,...
Yes, when you (left) click one list box item, normally, its color is changed. What's the problem?
...then I right click the mouse,I would like to show a Dialog,how can I do?
Normally, in a Windows application, the right-click is not used for showing a dialog but a floating popup menu. However, if you really, really want to do that, handle WM_CONTEXTMENU in the parent of the listbox.
Like in the next example.
void CMyCoolDialog::OnContextMenu(CWnd* pWnd, CPoint point)
{
if(pWnd->GetSafeHwnd() == m_listBox.m_hWnd)
{
AfxMessageBox(_T("Listbox Bau-bau!"));
}
}
# 2 Re: Hello,A difficulty question about listbox
void CMyCoolDialog::OnContextMenu(CWnd* pWnd, CPoint point)
{
if(pWnd->GetSafeHwnd() == m_listBox.m_hWnd)
{
AfxMessageBox(_T("Listbox Bau-bau!"));
}
}
Thanke you,ovidiucucu.But I don't know this function,what function is it?
# 3 Re: Hello,A difficulty question about listbox
See WM_CONTEXTMENU ( http://msdn2.microsoft.com/en-us/library/ms647592.aspx) notification message in MSDN.