Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionListview Sorting Pin
arun_pk31-Mar-10 18:38
arun_pk31-Mar-10 18:38 
AnswerRe: Listview Sorting Pin
Cool_Dev31-Mar-10 19:18
Cool_Dev31-Mar-10 19:18 
GeneralRe: Listview Sorting Pin
arun_pk31-Mar-10 19:22
arun_pk31-Mar-10 19:22 
GeneralRe: Listview Sorting Pin
Iain Clarke, Warrior Programmer31-Mar-10 21:23
Iain Clarke, Warrior Programmer31-Mar-10 21:23 
GeneralRe: Listview Sorting Pin
arun_pk31-Mar-10 22:02
arun_pk31-Mar-10 22:02 
AnswerRe: Listview Sorting Pin
Eugen Podsypalnikov31-Mar-10 19:40
Eugen Podsypalnikov31-Mar-10 19:40 
GeneralRe: Listview Sorting Pin
arun_pk31-Mar-10 19:50
arun_pk31-Mar-10 19:50 
GeneralRe: Listview Sorting Pin
Eugen Podsypalnikov31-Mar-10 20:39
Eugen Podsypalnikov31-Mar-10 20:39 
Good Morning, Arun Smile | :)

The sorting function has the following prototype:
int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);, where
- lParamSort is the third parameter of your above placed macro (hDlg in your case)
- lParam1 - is the Data associated with the first coming item to compare
- lParam1 - is the Data associated with the second coming item to compare

At the inserting of the items
you should associate a data (for example a number or pointer to a data set) with the item.
Please see the area Adding List-View Items and Subitems
at http://msdn.microsoft.com/en-us/library/bb774736(VS.85).aspx[^] Smile | :)

It is shown there
how you could associate a pointer to a data set
(line: lvI.lParam = (LPARAM) &rgPetInfo[index];) Smile | :)
Then, in your sorting function you could operate with the data:
just cast and operate with two data sets, for example:
PETINFO* petInfo1 =  (PETINFO*) lParam1;
PETINFO* petInfo2 =  (PETINFO*) lParam2;
return _tcscmp(petInfo1->szKind, petInfo2->szKind);

virtual void BeHappy() = 0;

GeneralRe: Listview Sorting Pin
arun_pk31-Mar-10 20:44
arun_pk31-Mar-10 20:44 
GeneralRe: Listview Sorting Pin
arun_pk20-Apr-10 19:30
arun_pk20-Apr-10 19:30 
GeneralRe: Listview Sorting Pin
Eugen Podsypalnikov20-Apr-10 21:53
Eugen Podsypalnikov20-Apr-10 21:53 
GeneralRe: Listview Sorting Pin
arun_pk20-Apr-10 22:07
arun_pk20-Apr-10 22:07 
GeneralRe: Listview Sorting Pin
Eugen Podsypalnikov20-Apr-10 22:09
Eugen Podsypalnikov20-Apr-10 22:09 
GeneralRe: Listview Sorting Pin
arun_pk20-Apr-10 22:13
arun_pk20-Apr-10 22:13 
GeneralRe: Listview Sorting Pin
Eugen Podsypalnikov20-Apr-10 22:15
Eugen Podsypalnikov20-Apr-10 22:15 
GeneralRe: Listview Sorting Pin
arun_pk20-Apr-10 22:09
arun_pk20-Apr-10 22:09 
GeneralRe: Listview Sorting Pin
Eugen Podsypalnikov20-Apr-10 22:12
Eugen Podsypalnikov20-Apr-10 22:12 
GeneralRe: Listview Sorting Pin
arun_pk20-Apr-10 22:14
arun_pk20-Apr-10 22:14 
GeneralRe: Listview Sorting Pin
Eugen Podsypalnikov20-Apr-10 22:37
Eugen Podsypalnikov20-Apr-10 22:37 
GeneralRe: Listview Sorting Pin
arun_pk20-Apr-10 22:44
arun_pk20-Apr-10 22:44 
GeneralRe: Listview Sorting Pin
arun_pk20-Apr-10 23:54
arun_pk20-Apr-10 23:54 
GeneralRe: Listview Sorting Pin
Eugen Podsypalnikov21-Apr-10 0:00
Eugen Podsypalnikov21-Apr-10 0:00 
GeneralRe: Listview Sorting Pin
arun_pk21-Apr-10 0:27
arun_pk21-Apr-10 0:27 
GeneralRe: Listview Sorting Pin
Eugen Podsypalnikov21-Apr-10 0:33
Eugen Podsypalnikov21-Apr-10 0:33 
GeneralRe: Listview Sorting Pin
arun_pk21-Apr-10 0:39
arun_pk21-Apr-10 0:39 

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.