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

C / C++ / MFC

 
GeneralRe: Win32 application with out an UI. Pin
Michael Schubert15-May-09 0:39
Michael Schubert15-May-09 0:39 
GeneralRe: Win32 application with out an UI. Pin
Rajesh R Subramanian15-May-09 0:44
professionalRajesh R Subramanian15-May-09 0:44 
QuestionHow to get the "Enter" Key down notification from CListCtrl Pin
Nitheesh George14-May-09 19:16
Nitheesh George14-May-09 19:16 
AnswerRe: How to get the "Enter" Key down notification from CListCtrl Pin
Chandrasekharan P14-May-09 20:34
Chandrasekharan P14-May-09 20:34 
GeneralRe: How to get the "Enter" Key down notification from CListCtrl Pin
Nitheesh George14-May-09 21:45
Nitheesh George14-May-09 21:45 
AnswerRe: How to get the "Enter" Key down notification from CListCtrl Pin
Code-o-mat14-May-09 22:18
Code-o-mat14-May-09 22:18 
GeneralRe: How to get the "Enter" Key down notification from CListCtrl Pin
Nitheesh George15-May-09 1:55
Nitheesh George15-May-09 1:55 
QuestionSorting using CListCtrl::SortItems Pin
JJeffrey14-May-09 17:06
JJeffrey14-May-09 17:06 
I'm having a problem using this function of the MFC List Control class

I've read the article : Example of CListCtrl::SortItems(...) in MSDN By Ivor S. Sargoytchev
Example of CListCtrl::SortItems(...) in MSDN[^]

And am trying out his example Callback funtion this way:

static int CALLBACK CompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
   // lParamSort contains a pointer to the list view control.
   CListCtrl* pListCtrl = (CListCtrl*) lParamSort;
   CString    strItem1 = pListCtrl->GetItemText(lParam1, 0);
   CString    strItem2 = pListCtrl->GetItemText(lParam2, 0);

   return _tcscmp(strItem1, strItem2);   // This should do ascending Sort, I believe?
}


Relevant Code:
LVCOLUMN lvColumn;					
int nCol =0;

lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvColumn.fmt = LVCFMT_LEFT;
lvColumn.cx = 120;
lvColumn.pszText = ColumnHeading[0];  //<-- Global Enum list of titles
nCol = m_MainList.InsertColumn(0, &lvColumn);

int NextIndex = nCol;
.
.
.
TCHAR	Output[50]={0};
while (<Not EOF>)
{
   <Read from file a string and copy into Output>
   LVITEM lvItem;
   lvItem.mask = LVIF_TEXT;
   lvItem.iItem = NextIndex;
   lvItem.iSubItem = 0;
   lvItem.pszText = Output;
   NextIndex = m_MainList.InsertItem(&lvItem);
}

m_MainList.SortItems(CompareProc, (LPARAM)&m_MainList);


m_MainList is the Control variable for a List Control box I placed on a dialog

I put a breakpoint inside the Sort Function CompareProc and found that lParam1 and lParam2 are always 0 constantly and never increasing.

I have been told it could be a pointer issue, but I don't get it. Can anyone help?
Thanks
AnswerRe: Sorting using CListCtrl::SortItems Pin
Naveen14-May-09 17:48
Naveen14-May-09 17:48 
GeneralRe: Sorting using CListCtrl::SortItems Pin
JJeffrey14-May-09 19:31
JJeffrey14-May-09 19:31 
GeneralRe: Sorting using CListCtrl::SortItems Pin
Naveen14-May-09 19:58
Naveen14-May-09 19:58 
GeneralRe: Sorting using CListCtrl::SortItems Pin
David Crow15-May-09 7:27
David Crow15-May-09 7:27 
QuestionC++, simulations call center traffic Pin
WILLIE GREER14-May-09 15:54
WILLIE GREER14-May-09 15:54 
AnswerRe: C++, simulations call center traffic Pin
CPallini14-May-09 20:42
mveCPallini14-May-09 20:42 
AnswerRe: C++, simulations call center traffic Pin
Rajesh R Subramanian14-May-09 22:35
professionalRajesh R Subramanian14-May-09 22:35 
GeneralRe: C++, simulations call center traffic Pin
Chandrasekharan P14-May-09 23:05
Chandrasekharan P14-May-09 23:05 
GeneralRe: C++, simulations call center traffic Pin
Rajesh R Subramanian14-May-09 23:11
professionalRajesh R Subramanian14-May-09 23:11 
GeneralRe: C++, simulations call center traffic [modified] Pin
CPallini14-May-09 23:28
mveCPallini14-May-09 23:28 
GeneralRe: C++, simulations call center traffic Pin
Rajesh R Subramanian14-May-09 23:33
professionalRajesh R Subramanian14-May-09 23:33 
GeneralRe: C++, simulations call center traffic Pin
CPallini14-May-09 23:43
mveCPallini14-May-09 23:43 
GeneralRe: C++, simulations call center traffic Pin
Rajesh R Subramanian14-May-09 23:57
professionalRajesh R Subramanian14-May-09 23:57 
GeneralRe: C++, simulations call center traffic Pin
CPallini15-May-09 0:10
mveCPallini15-May-09 0:10 
GeneralRe: C++, simulations call center traffic Pin
Rajesh R Subramanian15-May-09 2:19
professionalRajesh R Subramanian15-May-09 2:19 
AnswerRe: C++, simulations call center traffic Pin
Stuart Dootson15-May-09 0:01
professionalStuart Dootson15-May-09 0:01 
QuestionDLL Import library missing Pin
transoft14-May-09 12:57
transoft14-May-09 12:57 

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.