return TRUE;
return true;
	BOOL DoSortItems(int iCol, bool bDescending = false)	{		T* pT = static_cast<T*>(this);		ATLASSERT(::IsWindow(pT->m_hWnd));		ATLASSERT(iCol >= 0 && iCol < m_arrColSortType.GetSize());		WORD wType = m_arrColSortType[iCol];		if(wType == LVCOLSORT_NONE)			return FALSE;		int nCount = pT->GetItemCount();		if(nCount < 2)		{			m_bSortDescending = bDescending;			SetSortColumn(iCol);			return TRUE;		}		CWaitCursor waitCursor;		LVCompareParam* pParam = NULL;		ATLTRY(pParam = new LVCompareParam[nCount]);		PFNLVCOMPARE pFunc = NULL;		TCHAR pszTemp[pT->m_cchCmpTextMax];		bool bStrValue = false;		switch(wType)		{		case LVCOLSORT_TEXT:			pFunc = (PFNLVCOMPARE)pT->LVCompareText;		case LVCOLSORT_TEXTNOCASE:			if(pFunc == NULL)				pFunc = (PFNLVCOMPARE)pT->LVCompareTextNoCase;		case LVCOLSORT_CUSTOM:			{				if(pFunc == NULL)					pFunc = (PFNLVCOMPARE)pT->LVCompareCustom;				for(int i = 0; i < nCount; i++)				{					pParam[i].iItem = i;					pParam[i].dwItemData = pT->GetItemData(i);					pParam[i].pszValue = new TCHAR[pT->m_cchCmpTextMax];					pT->GetItemText(i, iCol, (LPTSTR)pParam[i].pszValue, pT->m_cchCmpTextMax);					pT->SetItemData(i, (DWORD_PTR)&pParam[i]);				}				bStrValue = true;			}			break;		case LVCOLSORT_LONG:			{				pFunc = (PFNLVCOMPARE)pT->LVCompareLong;				for(int i = 0; i < nCount; i++)				{					pParam[i].iItem = i;					pParam[i].dwItemData = pT->GetItemData(i);					pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax);					pParam[i].lValue = pT->StrToLong(pszTemp);					pT->SetItemData(i, (DWORD_PTR)&pParam[i]);				}			}			break;		case LVCOLSORT_DOUBLE:			{				pFunc = (PFNLVCOMPARE)pT->LVCompareDouble;				for(int i = 0; i < nCount; i++)				{					pParam[i].iItem = i;					pParam[i].dwItemData = pT->GetItemData(i);					pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax);					pParam[i].dblValue = pT->StrToDouble(pszTemp);					pT->SetItemData(i, (DWORD_PTR)&pParam[i]);				}			}			break;		case LVCOLSORT_DECIMAL:			{				pFunc = (PFNLVCOMPARE)pT->LVCompareDecimal;				for(int i = 0; i < nCount; i++)				{					pParam[i].iItem = i;					pParam[i].dwItemData = pT->GetItemData(i);					pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax);					pT->StrToDecimal(pszTemp, &pParam[i].decValue);					pT->SetItemData(i, (DWORD_PTR)&pParam[i]);				}			}			break;		case LVCOLSORT_DATETIME:		case LVCOLSORT_DATE:		case LVCOLSORT_TIME:			{				pFunc = (PFNLVCOMPARE)pT->LVCompareDouble;				DWORD dwFlags = LOCALE_NOUSEROVERRIDE;				if(wType == LVCOLSORT_DATE)					dwFlags |= VAR_DATEVALUEONLY;				else if(wType == LVCOLSORT_TIME)					dwFlags |= VAR_TIMEVALUEONLY;				for(int i = 0; i < nCount; i++)				{					pParam[i].iItem = i;					pParam[i].dwItemData = pT->GetItemData(i);					pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax);					pParam[i].dblValue = pT->DateStrToDouble(pszTemp, dwFlags);					pT->SetItemData(i, (DWORD_PTR)&pParam[i]);				}			}			break;		default:			ATLTRACE2(atlTraceUI, 0, _T("Unknown value for sort type in CSortListViewImpl::DoSortItems()\n"));			break;		} //switch(wType)		ATLASSERT(pFunc != NULL);		LVSortInfo lvsi = { pT, iCol, bDescending };		BOOL bRet = (BOOL)pT->DefWindowProc(LVM_SORTITEMS, (WPARAM)&lvsi, (LPARAM)pFunc);		for(int i = 0; i < nCount; i++)		{			DWORD_PTR dwItemData = pT->GetItemData(i);			LVCompareParam* p = (LVCompareParam*)dwItemData;			ATLASSERT(p != NULL);			if(bStrValue)				delete [] (TCHAR*)p->pszValue;			pT->SetItemData(i, p->dwItemData);		}		delete [] pParam;		if(bRet)		{			m_bSortDescending = bDescending;			SetSortColumn(iCol);		}		return bRet;	}