Click here to Skip to main content
16,012,223 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Having trouble retreiving a integer value from the Edit Control Box. Pin
Nelek3-Jun-08 21:38
protectorNelek3-Jun-08 21:38 
AnswerRe: Having trouble retreiving a integer value from the Edit Control Box. Pin
ThatsAlok20-Jul-09 1:04
ThatsAlok20-Jul-09 1:04 
QuestionCreating a .docx file programatically? Pin
ritz123430-May-08 5:12
ritz123430-May-08 5:12 
AnswerRe: Creating a .docx file programatically? Pin
Cedric Moonen30-May-08 6:05
Cedric Moonen30-May-08 6:05 
GeneralRe: Creating a .docx file programatically? Pin
led mike30-May-08 6:13
led mike30-May-08 6:13 
AnswerRe: Creating a .docx file programatically? Pin
led mike30-May-08 6:13
led mike30-May-08 6:13 
AnswerRe: Creating a .docx file programatically? Pin
David Crow30-May-08 7:56
David Crow30-May-08 7:56 
QuestionError with CArray, CMap Pin
Trupti Mehta30-May-08 4:44
Trupti Mehta30-May-08 4:44 
I am creating an application in VC++4 on Win CE5. The application is for a smart device with ARMV4I CPU. The code is compiled under the device SDK.

In the below code, I try to write all objects passed in an CArray object. The error that I get is also mentioned below.
void DbOperations::WriteDepartments(CArray<DeptDetails, DeptDetails&> dptArr)
{
	HANDLE hFile = CreateFile(DEPT_FILE,
	     GENERIC_WRITE, FILE_SHARE_WRITE,
         NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

	if (hFile == INVALID_HANDLE_VALUE)
		AfxMessageBox(_T("Error OPeniong File"));
	else {
		CFile myfile((int)hFile);
//		DeptDetails dd;

		CArchive ar(&myfile, CArchive::store);

		if (dptArr.GetSize() == 0)
			return;

		for (int pos=0; pos < dptArr.GetSize(); pos++) {
			DeptDetails& ddt = dptArr.ElementAt(pos);
			ddt.Serialize(ar);		
			ddt.~DeptDetails();
		}
		
//		dd.~DeptDetails();
		myfile.Close();
	}

	return;
}

ERROR: c:\program files\windows ce tools\wce500\mc1000c50\mfc\include\afxtempl.h(855) : error C2582: 'DeptDetails' : 'operator =' function is unavailable
        c:\program files\windows ce tools\wce500\mc1000c50\mfc\include\afxtempl.h(1578) : while compiling class-template member function 'struct __POSITION *__cdecl CList<class DeptDetails,class DeptDetails &>::AddTail(class DeptDetails &)'
Error executing clarm.exe.


I also tried the above with CMapStringToPtr
void DbOperations::WriteDepartments(CMapStringToPtr dptMap)
{

	HANDLE hFile = CreateFile(DEPT_FILE,
	     GENERIC_WRITE, FILE_SHARE_WRITE,
         NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

	if (hFile == INVALID_HANDLE_VALUE)
		AfxMessageBox(_T("Error OPeniong File"));
	else {
		CFile myfile((int)hFile);
		CString key;
		DeptDetails* dd;

		CArchive ar(&myfile, CArchive::store);


		for (POSITION pos = dptMap.GetStartPosition(); pos != NULL;) {
			dptMap.GetNextAssoc(pos, key, (DeptDetails*&)dd ); //.GetNextAssoc(pos, key, (DeptDetails*&)dd);
			dd->Serialize(ar);		
		}
		
		key.Empty();
		dd->~DeptDetails();
		myfile.Close();
	}

	return;
}

ERROR :  : error C2664: 'GetNextAssoc' : cannot convert parameter 3 from 'class DeptDetails *' to 'void *& '
        A reference that is not to 'const' cannot be bound to a non-lvalue
Error executing clarm.exe.


Also, if I don't comment the code of CMap, I don't get any errot of CArray; only error of CMap else of CArray.

Does anyone has any idea where I am going wrong. Please help me out.

Thanks

Terry

QuestionRe: Error with CArray, CMap Pin
David Crow30-May-08 4:59
David Crow30-May-08 4:59 
AnswerRe: Error with CArray, CMap Pin
Jijo.Raj30-May-08 5:52
Jijo.Raj30-May-08 5:52 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta30-May-08 22:41
Trupti Mehta30-May-08 22:41 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj30-May-08 23:16
Jijo.Raj30-May-08 23:16 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta31-May-08 0:38
Trupti Mehta31-May-08 0:38 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj31-May-08 6:28
Jijo.Raj31-May-08 6:28 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta1-Jun-08 0:05
Trupti Mehta1-Jun-08 0:05 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj1-Jun-08 1:59
Jijo.Raj1-Jun-08 1:59 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta1-Jun-08 8:57
Trupti Mehta1-Jun-08 8:57 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj1-Jun-08 23:11
Jijo.Raj1-Jun-08 23:11 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta2-Jun-08 2:09
Trupti Mehta2-Jun-08 2:09 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj2-Jun-08 4:27
Jijo.Raj2-Jun-08 4:27 
QuestionCannot run the exe of my application Pin
vijay_aroli30-May-08 2:55
vijay_aroli30-May-08 2:55 
QuestionRe: Cannot run the exe of my application Pin
David Crow30-May-08 3:15
David Crow30-May-08 3:15 
AnswerRe: Cannot run the exe of my application Pin
Mike Dimmick30-May-08 7:16
Mike Dimmick30-May-08 7:16 
QuestionHow to remove a folder and all its contents Pin
piul30-May-08 0:25
piul30-May-08 0:25 
QuestionRe: How to remove a folder and all its contents Pin
CPallini30-May-08 0:32
mveCPallini30-May-08 0:32 

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.