Click here to Skip to main content
15,904,155 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generallooking for freelance MFC programmer in london Pin
scott incz30-Apr-04 9:13
scott incz30-Apr-04 9:13 
GeneralCrystal Report Error 'Creation Feature not Enabled' Pin
Anonymous30-Apr-04 8:56
Anonymous30-Apr-04 8:56 
GeneralAdd Message Handler in VC7.0 Pin
pie30-Apr-04 8:25
pie30-Apr-04 8:25 
GeneralRe: Add Message Handler in VC7.0 Pin
Jason Henderson30-Apr-04 9:18
Jason Henderson30-Apr-04 9:18 
GeneralRe: Add Message Handler in VC7.0 Pin
pie30-Apr-04 9:26
pie30-Apr-04 9:26 
GeneralRe: Add Message Handler in VC7.0 Pin
Jason Henderson30-Apr-04 9:29
Jason Henderson30-Apr-04 9:29 
GeneralRe: Add Message Handler in VC7.0 Pin
pie30-Apr-04 9:35
pie30-Apr-04 9:35 
GeneralRe: Add Message Handler in VC7.0 Pin
Jason Henderson30-Apr-04 9:37
Jason Henderson30-Apr-04 9:37 
GeneralRe: Add Message Handler in VC7.0 Pin
pie30-Apr-04 9:44
pie30-Apr-04 9:44 
GeneralRe: Add Message Handler in VC7.0 Pin
l a u r e n30-Apr-04 19:45
l a u r e n30-Apr-04 19:45 
GeneralDeleting Start-Menu Folder Pin
Brad Bruce30-Apr-04 8:06
Brad Bruce30-Apr-04 8:06 
GeneralRe: Deleting Start-Menu Folder Pin
David Crow30-Apr-04 8:15
David Crow30-Apr-04 8:15 
GeneralRe: Deleting Start-Menu Folder Pin
Brad Bruce30-Apr-04 13:02
Brad Bruce30-Apr-04 13:02 
Generallocalization with satellite dll's Pin
Konrad Windszus30-Apr-04 7:55
Konrad Windszus30-Apr-04 7:55 
GeneralList Control Pin
aman200630-Apr-04 7:34
aman200630-Apr-04 7:34 
GeneralRe: List Control Pin
David Crow30-Apr-04 7:59
David Crow30-Apr-04 7:59 
GeneralRe: List Control Pin
aman200630-Apr-04 8:06
aman200630-Apr-04 8:06 
GeneralRe: List Control Pin
David Crow30-Apr-04 8:12
David Crow30-Apr-04 8:12 
GeneralRe: List Control Pin
aman200630-Apr-04 8:33
aman200630-Apr-04 8:33 
GeneralRe: List Control Pin
David Crow30-Apr-04 8:41
David Crow30-Apr-04 8:41 
GeneralRe: List Control Pin
aman200630-Apr-04 8:45
aman200630-Apr-04 8:45 
GeneralRe: List Control Pin
David Crow30-Apr-04 9:50
David Crow30-Apr-04 9:50 
GeneralRe: List Control Pin
aman200630-Apr-04 10:42
aman200630-Apr-04 10:42 
Here u go:

typedef struct _tagSORTDATA
{
INT isortSubItem;
CListCtrl *m_pointer;
INT iUPDOWN;
BOOL StringComp;
} SORTDATA;
enum{
eSORT_UP = 1,
eSORT_DOWN
};
void CEditForm::OnColumnclickHistoryList(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
static WORD nSort;
SORTDATA sortData;

m_RecordList =(CListCtrl*)GetDlgItem(IDC_HISTORY_LIST);


if(nSort == eSORT_UP)
nSort = eSORT_DOWN;
else
nSort = eSORT_UP;

sortData.isortSubItem = pNMListView->iSubItem;
sortData.iUPDOWN = nSort;
sortData.m_pointer = (CListCtrl*)m_RecordList;
sortData.StringComp = TRUE;
if(m_RecordList->SortItems(ListViewCompProc, (DWORD)(LPARAM)&sortData) != TRUE)
AfxMessageBox(_T("Error"));


*pResult = 0;
}


int CALLBACK CEditForm::ListViewCompProc(LPARAM lp1, LPARAM lp2, LPARAM lp3)
{
static LVFINDINFO lvf;
static INT nItem1, nItem2;
CString buf1, buf2;




SORTDATA *lpsd;

lpsd = (SORTDATA *)lp3;
CListCtrl *m_RecordList = (CListCtrl*)lpsd->m_pointer;

lvf.flags = LVFI_PARAM;
lvf.lParam = lp1;
// nItem1 = ListView_FindItem(lpsd->hwndList, -1, &lvf);
nItem1 = m_RecordList->FindItem(&lvf);

lvf.lParam = lp2;
//nItem2 = ListView_FindItem(lpsd->hwndList, -1, &lvf);
nItem2 = m_RecordList->FindItem(&lvf);

//ListView_GetItemText(lpsd->hwndList, nItem1, lpsd->isortSubItem, buf1, sizeof(buf1));
buf1 = m_RecordList->GetItemText(nItem1,lpsd->isortSubItem);
//ListView_GetItemText(lpsd->hwndList, nItem2, lpsd->isortSubItem, buf2, sizeof(buf2));
buf2 = m_RecordList->GetItemText(nItem2,lpsd->isortSubItem);

if (lpsd->isortSubItem != 9)
{
// string comparision
if (lpsd->iUPDOWN == eSORT_UP)
{
return(buf1.Compare(buf2));
}
else
{
return(buf1.Compare(buf2) * -1);
}
}
else
{
// digit comparision
if (lpsd->iUPDOWN == eSORT_UP)
{
if (_ttoi(buf1) > _ttoi(buf2))
return 1;
else if (_ttoi(buf1) == _ttoi(buf2))
return 0;
else
return -1;
}
else
{
if (_ttoi(buf1) > _ttoi(buf2))
return -1;
else if (_ttoi(buf1) == _ttoi(buf2))
return 0;
else
return 1;
}
}
return 0;
}


GeneralRe: List Control Pin
David Crow30-Apr-04 10:53
David Crow30-Apr-04 10:53 
GeneralConsole Application Pin
maxpayne30-Apr-04 6:44
maxpayne30-Apr-04 6:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.