CMFCListctrl- how to turn off sorting on colum click

  • Thread starter Thread starter sgrm123
  • Start date Start date
S

sgrm123

Guest
Hi,

I am using CMFClistCtrl in my MFC dialog based application. When click on colum header it is trying to sort.Sometimes it is crashing for me.

How to turn off sorting in CMFClistCtrl ?

void CMFCListCtrl::OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
ENSURE(pNMListView != NULL);

int iColumn = pNMListView->iSubItem;
BOOL bShiftIsPressed = (::GetAsyncKeyState(VK_SHIFT) & 0x8000);
int nColumnState = GetHeaderCtrl().GetColumnState(iColumn);
BOOL bAscending = TRUE;

if (nColumnState != 0)
{
bAscending = nColumnState <= 0;
}

Sort(iColumn, bAscending, bShiftIsPressed && IsMultipleSort());
*pResult = 0;
}

Continue reading...
 
Back
Top