Click here to Skip to main content
16,011,383 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem with pTreectrl->Create(...); Pin
bilas3-Dec-03 10:11
bilas3-Dec-03 10:11 
GeneralGetting the Current Application Path Pin
harinat3-Dec-03 2:06
harinat3-Dec-03 2:06 
GeneralRe: Getting the Current Application Path Pin
Antti Keskinen3-Dec-03 2:21
Antti Keskinen3-Dec-03 2:21 
GeneralRe: Getting the Current Application Path Pin
David Crow3-Dec-03 3:14
David Crow3-Dec-03 3:14 
GeneralRe: Getting the Current Application Path Pin
valikac3-Dec-03 6:28
valikac3-Dec-03 6:28 
GeneralRe: Getting the Current Application Path Pin
Michael Dunn3-Dec-03 13:04
sitebuilderMichael Dunn3-Dec-03 13:04 
GeneralProblem w/ CListCtrl::SortItems Pin
De Nardis Andrea3-Dec-03 1:16
De Nardis Andrea3-Dec-03 1:16 
GeneralRe: Problem w/ CListCtrl::SortItems Pin
David Crow3-Dec-03 3:26
David Crow3-Dec-03 3:26 
De Nardis Andrea wrote:
...MyCompareProc is called exactly as many times as the item number but this is clearly not sufficient for a complet alphabetical order

That depends on the sorting algorithm used. While some algorithms look at each item multiple times (e.g., bubble), others look at each item fewer times, or even just once. I suspect that the algorithm employed by SortItems() is based on Hoare's partition-exchange (i.e., quicksort) algorithm.

As you add items to the control, a call to SetItemData() should be made. For example, the item's data could be a pointer to a CMyObject class. Then the comparison routine will look like:

static int CALLBACK 
MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
    CMyObject *p1 = (CMyObject *) lParam1;
    CMyObject *p2 = (CMyObject *) lParam2;
    CString str1 = p1->SomeString;
    CString str2 = p2->SomeString;
 
    return strcmp(str1, str2);
}



Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?

GeneralPopup menus Pin
chadell3-Dec-03 1:16
chadell3-Dec-03 1:16 
GeneralRe: Popup menus Pin
De Nardis Andrea3-Dec-03 1:25
De Nardis Andrea3-Dec-03 1:25 
GeneralRe: Popup menus Pin
viliam3-Dec-03 1:28
viliam3-Dec-03 1:28 
GeneralRe: Popup menus Pin
chadell3-Dec-03 3:36
chadell3-Dec-03 3:36 
GeneralAdobe Audition/Cool Edit Plug-in Pin
Trevor13-Dec-03 1:14
Trevor13-Dec-03 1:14 
GeneralRe: Adobe Audition/Cool Edit Plug-in - PART 2 Pin
Trevor13-Dec-03 1:21
Trevor13-Dec-03 1:21 
GeneralProblem using CADODatabase and CADORecordset classes. Pin
bilas3-Dec-03 1:05
bilas3-Dec-03 1:05 
GeneralRe: Problem using CADODatabase and CADORecordset classes. Pin
RChin3-Dec-03 2:03
RChin3-Dec-03 2:03 
GeneralRe: Problem using CADODatabase and CADORecordset classes. Pin
bilas3-Dec-03 3:25
bilas3-Dec-03 3:25 
GeneralRe: Problem using CADODatabase and CADORecordset classes. Pin
RChin3-Dec-03 5:04
RChin3-Dec-03 5:04 
GeneralRe: Problem using CADODatabase and CADORecordset classes. Pin
bilas3-Dec-03 11:10
bilas3-Dec-03 11:10 
GeneralError with slider index. Pin
vgrigor3-Dec-03 0:40
vgrigor3-Dec-03 0:40 
GeneralRe: Error with slider index. Pin
Antti Keskinen3-Dec-03 1:50
Antti Keskinen3-Dec-03 1:50 
GeneralRe: Error with slider index. Pin
vgrigor3-Dec-03 2:23
vgrigor3-Dec-03 2:23 
GeneralRe: Error with slider index. Pin
Antti Keskinen3-Dec-03 3:25
Antti Keskinen3-Dec-03 3:25 
GeneralOutlook please help Pin
Jump_Around3-Dec-03 0:36
Jump_Around3-Dec-03 0:36 
GeneralRe: Outlook please help Pin
Antti Keskinen3-Dec-03 1:56
Antti Keskinen3-Dec-03 1:56 

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.