Click here to Skip to main content
15,892,643 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Visual C++ Compiler bug Pin
Alexandru Savescu16-Jul-02 4:02
Alexandru Savescu16-Jul-02 4:02 
GeneralRe: Visual C++ Compiler bug Pin
Ruca16-Jul-02 5:19
Ruca16-Jul-02 5:19 
GeneralATL Enter Key in properties closes the sheet ! Pin
Braulio Dez16-Jul-02 0:22
Braulio Dez16-Jul-02 0:22 
GeneralSorting items in CListCtrl ? Sample from MSDN.. Pin
Yo Yo~~16-Jul-02 0:02
sussYo Yo~~16-Jul-02 0:02 
GeneralRe: Sorting items in CListCtrl ? Sample from MSDN.. Pin
Koep16-Jul-02 0:54
Koep16-Jul-02 0:54 
GeneralRe: Sorting items in CListCtrl ? Sample from MSDN.. Pin
Orbital^16-Jul-02 0:58
Orbital^16-Jul-02 0:58 
GeneralRe: Sorting items in CListCtrl ? Sample from MSDN.. Pin
Koep16-Jul-02 1:02
Koep16-Jul-02 1:02 
GeneralRe: Sorting items in CListCtrl ? Sample from MSDN.. Pin
Yo Yo~~17-Jul-02 0:29
sussYo Yo~~17-Jul-02 0:29 
>>U have to fill the params associated with the items/subitems first.
>>For instance, pointer to the DataClass instance. Then u can get/compare
>>everything from inside the class.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thanks ! I have tried it.

But I still got some problems on this lParam1 and lParam2.
That is, when I implement the Compare Function just like the sample from MSDN,
as follows:

int CALLBACK CSortListCtrl::CompareFunction(LPARAM lParam1, LPARAM lParam2, LPARAM lParamData)
{
CSortListCtrl* pListCtrl = reinterpret_cast<csortlistctrl*>( lParamData );
ASSERT( pListCtrl->IsKindOf( RUNTIME_CLASS( CListCtrl ) ) );

CString strItem1 = pListCtrl->GetItemText( lParam1, pListCtrl->m_iSortColumn );
CString strItem2 = pListCtrl->GetItemText( lParam2, pListCtrl->m_iSortColumn );

return strcmp(strItem2, strItem1);
}

I always got lParam1 and lParam2 the SAME !! That is, the Compare Function is always comparing the same thing ! (The first item always ! And I found the lParam1 and lParam2 are always 0 !!)

The following is how I added items to my list control:
/// m_CtrlEntryList is of type CSortListCtrl, which is also of type CListCtrl

//// add subitem 0 first
m_CtrlEntryList.InsertItem( iItemNo, szString );

LV_ITEM lvitem;
ZeroMemory( &lvitem, sizeof( lvitem ) );

/// then add subitem 1 ~ 3
lvitem.mask = LVIF_TEXT;
lvitem.iItem = iItemNo;
lvitem.pszText = szString;
lvitem.iSubItem = iSubItemNo;

lvitem.lParam = iItemNo; // <------ I DO specify this lParam
m_CtrlEntryList.SetItem( &lvitem );


I used something like above to add items to my list control, and it really worked and displayed fine. I don't know why when I get them compared, the 2 parameters passed to compare function are always 0.

Anything wrong ?
GeneralRe: Sorting items in CListCtrl ? Sample from MSDN.. Pin
Yo Yo~~17-Jul-02 0:54
sussYo Yo~~17-Jul-02 0:54 
GeneralRe: Sorting items in CListCtrl ? Sample from MSDN.. Pin
Koep17-Jul-02 1:54
Koep17-Jul-02 1:54 
GeneralRe: Sorting items in CListCtrl ? Sample from MSDN.. Pin
Yo Yo~~18-Jul-02 0:48
sussYo Yo~~18-Jul-02 0:48 
QuestionDifference between dialog an form? Pin
Hel15-Jul-02 22:30
Hel15-Jul-02 22:30 
AnswerRe: Difference between dialog an form? Pin
Christian Graus15-Jul-02 22:36
protectorChristian Graus15-Jul-02 22:36 
GeneralRe: Difference between dialog an form? Pin
Hel15-Jul-02 22:45
Hel15-Jul-02 22:45 
GeneralRe: Difference between dialog an form? Pin
Christian Graus15-Jul-02 22:48
protectorChristian Graus15-Jul-02 22:48 
GeneralRe: Difference between dialog an form? Pin
Hel15-Jul-02 23:00
Hel15-Jul-02 23:00 
GeneralVC++ Pin
KrishnaRaj15-Jul-02 22:24
KrishnaRaj15-Jul-02 22:24 
GeneralRe: VC++ Pin
Christian Graus16-Jul-02 0:12
protectorChristian Graus16-Jul-02 0:12 
GeneralRe: VC++ Pin
KrishnaRaj17-Jul-02 20:42
KrishnaRaj17-Jul-02 20:42 
GeneralRe: VC++ Pin
Christian Graus17-Jul-02 21:07
protectorChristian Graus17-Jul-02 21:07 
GeneralEnumerating IE Frames and connecting to its events Pin
Alex Cramer15-Jul-02 22:18
Alex Cramer15-Jul-02 22:18 
Questionhow to use map in this way? Pin
Anonymous15-Jul-02 22:18
Anonymous15-Jul-02 22:18 
AnswerRe: how to use map in this way? Pin
Christian Graus15-Jul-02 22:38
protectorChristian Graus15-Jul-02 22:38 
General'MIIM_STRING' : undeclared identifier Pin
Sprudling15-Jul-02 22:08
Sprudling15-Jul-02 22:08 
GeneralFigured it out \o/ =) Pin
Sprudling15-Jul-02 22:25
Sprudling15-Jul-02 22:25 

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.