Click here to Skip to main content
15,921,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: having problem terminating a thread Pin
Randor 2-Aug-07 11:07
professional Randor 2-Aug-07 11:07 
GeneralRe: having problem terminating a thread Pin
alberthyc2-Aug-07 11:13
alberthyc2-Aug-07 11:13 
AnswerRe: having problem terminating a thread Pin
David Crow2-Aug-07 10:46
David Crow2-Aug-07 10:46 
QuestionDiffrenece between executing a program within IDE and Windows Explorer Pin
Joseph Marzbani2-Aug-07 8:41
Joseph Marzbani2-Aug-07 8:41 
AnswerRe: Diffrenece between executing a program within IDE and Windows Explorer Pin
Randor 2-Aug-07 10:44
professional Randor 2-Aug-07 10:44 
QuestionRe: Diffrenece between executing a program within IDE and Windows Explorer Pin
David Crow2-Aug-07 10:47
David Crow2-Aug-07 10:47 
QuestionReport view list control drawing difference when manifest file used Pin
Keith Worden2-Aug-07 6:29
Keith Worden2-Aug-07 6:29 
QuestionMFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
Sternocera2-Aug-07 5:15
Sternocera2-Aug-07 5:15 
Hello,

I'm following this tutorial for MFC/C++: http://www.codeproject.com/listctrl/creportctrl.asp . This concerns implementing a CListCtrl-derived class with certain "out of the box" functionality that the MFC "report style" CListCtrl lacks. For example, the user can re-order items by clicking on a column header, and, optionally, the programmer can include a checkbox beside nodes.

I created a dialog that uses this CReportCtrl, but that didn't work - I could see entries, but there were no headings, and no lines, even though I'd called the SetGridLines() member function.

I then called ModifyStyle(0,LVS_REPORT), which is meant to be used with the CListCtrl base class. Now, CReportCtrl was mostly fully functional. The column headers were visible. When I called SetGridLines(TRUE), gridlines appeared. However, one last important piece of functionality was still missing: I couldn't re-order column entries by clicking on a column header, in the style of windows explorer.

I can confirm that the function(OnColumnClick) is called when I click on a column header. I can confirm that _CompareFunction is *not* being called.

Most recently, I changed the List dialog item properties view from "Icon" to "Report". This had the effect of causing all sorts of errors such as "Unhandled exception at 0x78144580 in Lustre.exe: 0xC0000005: Access violation reading location 0x0aa30324" when I debugged. Apparently, this was the offending code:
int CReportCtrl::InsertItem(int nIndex, LPCTSTR pszText, ...)<br />
{<br />
	const int iIndex = CListCtrl::InsertItem(nIndex, pszText);<br />
<br />
	if (!_IsValidIndex(iIndex))<br />
		return iIndex;<br />
<br />
	CStringArray arr;<br />
	arr.Add(pszText);<br />
<br />
 	va_list list;<br />
	va_start(list, pszText);<br />
<br />
	for(int iColumn = 1; iColumn < GetColumnCount(); iColumn++)<br />
	{<br />
		LPCTSTR lpsz = va_arg(list, LPCTSTR);<br />
		CString str = (lpsz == NULL) ? _T("") : lpsz;<br />
		arr.Add(str); // This particular line was flagged by visual studio<br />
		CListCtrl::SetItemText(iIndex, iColumn, str);<br />
	}<br />
<br />
	va_end(list);<br />
<br />
	_AssignNewItemData(iIndex, arr.GetData(), arr.GetSize());<br />
<br />
	return iIndex;<br />
}


I'd be very grateful if someone could point me in the right direction. I suspect this has something to do with the fact that I am using visual studio 2005, and this tutorial was created with visual studio 6,

Thanks a lot,
SternoceraFrown | :( (Frown | :( (Frown | :( (Frown | :(
QuestionRe: MFC: CListCtrl derived class, &amp;quot;creportctrl&amp;quot; tutorial problem Pin
David Crow2-Aug-07 5:17
David Crow2-Aug-07 5:17 
AnswerRe: MFC: CListCtrl derived class, &amp;quot;creportctrl&amp;quot; tutorial problem Pin
Sternocera2-Aug-07 5:19
Sternocera2-Aug-07 5:19 
QuestionRe: MFC: CListCtrl derived class, &amp;quot;creportctrl&amp;quot; tutorial problem Pin
David Crow2-Aug-07 5:27
David Crow2-Aug-07 5:27 
AnswerRe: MFC: CListCtrl derived class, &amp;quot;creportctrl&amp;quot; tutorial problem Pin
Sternocera2-Aug-07 5:29
Sternocera2-Aug-07 5:29 
AnswerRe: MFC: CListCtrl derived class, &quot;creportctrl&quot; tutorial problem Pin
led mike2-Aug-07 7:15
led mike2-Aug-07 7:15 
GeneralRe: MFC: CListCtrl derived class, &quot;creportctrl&quot; tutorial problem Pin
Sternocera2-Aug-07 7:21
Sternocera2-Aug-07 7:21 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
led mike2-Aug-07 7:31
led mike2-Aug-07 7:31 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
Sternocera2-Aug-07 7:35
Sternocera2-Aug-07 7:35 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
David Crow2-Aug-07 8:05
David Crow2-Aug-07 8:05 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
Sternocera2-Aug-07 10:08
Sternocera2-Aug-07 10:08 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
David Crow2-Aug-07 10:44
David Crow2-Aug-07 10:44 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
Sternocera2-Aug-07 22:13
Sternocera2-Aug-07 22:13 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
David Crow3-Aug-07 2:43
David Crow3-Aug-07 2:43 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
Sternocera2-Aug-07 22:24
Sternocera2-Aug-07 22:24 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
David Crow3-Aug-07 2:45
David Crow3-Aug-07 2:45 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
Sternocera3-Aug-07 2:46
Sternocera3-Aug-07 2:46 
GeneralRe: MFC: CListCtrl derived class, "creportctrl" tutorial problem Pin
Haroon Sarwar2-Aug-07 18:26
Haroon Sarwar2-Aug-07 18:26 

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.