Click here to Skip to main content
16,004,806 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Sound Pin
Archyami15-Oct-07 4:30
Archyami15-Oct-07 4:30 
QuestionRe: Sound Pin
David Crow15-Oct-07 4:33
David Crow15-Oct-07 4:33 
AnswerRe: Sound Pin
Archyami15-Oct-07 4:36
Archyami15-Oct-07 4:36 
QuestionRe: Sound Pin
David Crow15-Oct-07 5:04
David Crow15-Oct-07 5:04 
AnswerRe: Sound Pin
Archyami15-Oct-07 15:14
Archyami15-Oct-07 15:14 
QuestionRe: Sound Pin
Nishad S15-Oct-07 17:57
Nishad S15-Oct-07 17:57 
AnswerRe: Sound Pin
Archyami15-Oct-07 18:03
Archyami15-Oct-07 18:03 
QuestionGroups in List Controls [modified] Pin
VonHagNDaz15-Oct-07 3:58
VonHagNDaz15-Oct-07 3:58 
Hey guys, I'm having some problems adding a groups to a list control object. Here is what I'm trying:

LVGROUP group;<br />
ZeroMemory(&group, sizeof(group));<br />
<br />
			// Set group<br />
			group.cbSize = sizeof(group);<br />
			group.mask = LVGF_HEADER | LVGF_GROUPID | LVGF_ALIGN;<br />
<br />
			// Convert string value to LPWSTR value for group.pzHeader<br />
			LPWSTR header = new WCHAR[printableAttributes->name->size() + 1];<br />
			MultiByteToWideChar(0, 0, printableAttributes->name->c_str(), -1, header, <br />
				(int)printableAttributes->name->size() + 1);<br />
<br />
			// Set Group name<br />
			group.pszHeader = header;<br />
			group.cchHeader = (int)wcslen(group.pszHeader);<br />
<br />
			group.iGroupId = index;<br />
			group.uAlign = LVGA_HEADER_CENTER;<br />
<br />
			listControl->InsertGroup(index, &group);<br />
<br />
			// Temporary variables<br />
			NonCompositeJob* temp;<br />
			LVITEM item;<br />
  <br />
			// Insert items into group<br />
			for(int i = 0; i < (int)((CompositeJob*)job)->getNoJobs(); i++)<br />
			{<br />
				ZeroMemory(&item, sizeof(item));<br />
				item.iItem = i;<br />
				item.mask = LVIF_GROUPID;<br />
				item.iGroupId = group.iGroupId;<br />
				item.iSubItem = i + 1;<br />
<br />
				temp = ((CompositeJob*)job)->getJob(i);<br />
<br />
				//Name<br />
				listControl->InsertItem(i, (LPCTSTR)printableAttributes-><br />
						name->c_str());<br />
<br />
				//Total Copies Printed<br />
				listControl->SetItemText(i, 1, (LPCTSTR)printableAttributes-><br />
						totalNumberOfCopiesPrinted->c_str());<br />
<br />
				//Job Status<br />
				listControl->SetItemText(i, 2, (LPCTSTR)printableAttributes-><br />
						status->c_str());<br />
<br />
				//Job Type<br />
				listControl->SetItemText(i, 3, (LPCTSTR)printableAttributes-><br />
						type->c_str());<br />
<br />
				//File Size<br />
				listControl->SetItemText(i, 4, (LPCTSTR)printableAttributes-><br />
						fileSize->c_str());<br />
<br />
				//File Location<br />
				listControl->SetItemText(i, 5, (LPCTSTR)printableAttributes-><br />
						fileLocation->c_str());<br />
<br />
				listControl->SetItemData(i, (DWORD_PTR)temp);<br />
				listControl->InsertItem(&item);


groups is the LSVGROUP object and item is the LVITEM. index is the index of the list control object(listControl). CompositeJob is an object that holds 2+ print jobs.

In the loop, I'm trying to add the items one at a time and getNoJobs returns the number of jobs inside of the CompositeJob object. After creating the group, I try to add each item to the group, I set the text of the fields that will be displayed for each of the objects in the group, return to the top of the loop, and continue for each job in the CompositeJob object.

-- modified at 10:14 Monday 15th October, 2007

When I add 2 composite jobs to the list, I end up with 4 entries, two for each one.

[Insert Witty Sig Here]

QuestionRe: Groups in List Controls Pin
Nelek15-Oct-07 4:09
protectorNelek15-Oct-07 4:09 
AnswerRe: Groups in List Controls Pin
VonHagNDaz15-Oct-07 4:14
VonHagNDaz15-Oct-07 4:14 
AnswerRe: Groups in List Controls Pin
Roger Broomfield15-Oct-07 17:21
Roger Broomfield15-Oct-07 17:21 
AnswerRe: Groups in List Controls Pin
Alex Cohn16-Oct-07 1:35
Alex Cohn16-Oct-07 1:35 
QuestionTest Database Connection Pin
Programm3r15-Oct-07 3:37
Programm3r15-Oct-07 3:37 
QuestionRe: Test Database Connection Pin
David Crow15-Oct-07 3:51
David Crow15-Oct-07 3:51 
QuestionRe: Test Database Connection Pin
Programm3r15-Oct-07 4:20
Programm3r15-Oct-07 4:20 
QuestionRe: Test Database Connection Pin
David Crow15-Oct-07 4:22
David Crow15-Oct-07 4:22 
AnswerRe: Test Database Connection Pin
Programm3r15-Oct-07 4:48
Programm3r15-Oct-07 4:48 
GeneralRe: Test Database Connection Pin
David Crow15-Oct-07 5:02
David Crow15-Oct-07 5:02 
AnswerRe: Test Database Connection Pin
James R. Twine15-Oct-07 7:50
James R. Twine15-Oct-07 7:50 
GeneralRe: Test Database Connection Pin
Programm3r15-Oct-07 19:47
Programm3r15-Oct-07 19:47 
Questionan application can create .exe file by some conditions Pin
jarful15-Oct-07 3:33
jarful15-Oct-07 3:33 
AnswerRe: an application can create .exe file by some conditions Pin
David Crow15-Oct-07 3:49
David Crow15-Oct-07 3:49 
AnswerRe: an application can create .exe file by some conditions Pin
Matthew Faithfull15-Oct-07 3:51
Matthew Faithfull15-Oct-07 3:51 
AnswerRe: an application can create .exe file by some conditions Pin
Hamid_RT15-Oct-07 19:36
Hamid_RT15-Oct-07 19:36 
Questionphp and vc++ compatible encryption algorithm??? Pin
programmer8115-Oct-07 2:45
programmer8115-Oct-07 2:45 

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.