Click here to Skip to main content
15,790,917 members

Comments by hairy_hats (Top 35 by date)

hairy_hats 15-Feb-17 6:02am View    
The simplest way seems to be to compare the requested file save path with the auto-save path in OnSaveDocument and set a manual/auto-save flag appropriately before saving the file:

BOOL CMyDoc::OnSaveDocument(LPCTSTR lpszPathName) 
	CDataRecoveryHandler* autohandler = AfxGetApp()->GetDataRecoveryHandler();
	CString autosavepath = autohandler->GetAutosavePath();
	BOOL success = FALSE;

	if (CString(lpszPathName).Left(autosavepath.GetLength()).CompareNoCase(autosavepath) == 0)
		// autosaving - just call the default
		m_manualSave = false;

		success = CDocument::OnSaveDocument(lpszPathName);
		// manual save - do whatever is needed
		m_manualSave = true;

		success = CDocument::OnSaveDocument(lpszPathName);
	return success;
hairy_hats 30-Nov-16 7:35am View    
For Arduino-specific problems you might be better off asking on the Arduino forums.
hairy_hats 29-Nov-16 11:30am View    
The mystery deepens. I've moved the classes back into the EXE and the problem persists: the first object to be deserialized is fine, but the second is mis-interpreted by the schema lookup code.
hairy_hats 29-Nov-16 7:47am View    
Suppose you had:

char [] hello = "Hello, world!";

CString string(hello); // string contains "Hello, World!"

strcpy(hello, "Goodbye!");

If you use cstr=str; then string now contains "Goodbye!" even though you changed hello. If you allocate your own memory and copy the initialisation text, then your class's internal text doesn't change.
hairy_hats 29-Nov-16 6:12am View    
Please can you explain further why I need to override the >> operator when the first object loads correctly using the >> operator? Thanks!

Also, doesn't CodeProject contain many classes which derive from MFC classes in DLLs?!