When I open an existing file with the stock dialog in an MDI I can see
lpszFileName
is evaluated in the following function . After that I don't know where to look to set a pointer to the CFile.
Document* CMFCApplication3App::OpenDocumentFile(LPCTSTR lpszFileName)
{
return CWinApp::OpenDocumentFile(lpszFileName);
}
When I step through the code I never enter
CDocument::OnOpenDocument
. When I try to retrieve data from the file with
CDocument::Serialize
it eventually fails with an error box saying "Failed to open document". I don't understand why the process never enters
CDocument::OnOpenDocument
.
What I have tried:
The serialize trail from
CDocument
to the class where my data is held in
CArray
is as follows:
void TaxonTreeDoc::Serialize(CArchive& ar)
{
Taxa.Serialize(ar);
}
void CTaxon::Serialize(CArchive& archive)
{
CObject::Serialize(archive);
if (archive.IsStoring())
archive << Rank << TName << TParent << IntegumentFileName << ExtCharFileName;
else
archive >> Rank >> TName << TParent << IntegumentFileName << ExtCharFileName;
int i = 1;}
typedef CArray<ctaxon, ctaxon&> TaxonArray;
template<> inline void AFXAPI SerializeElements<ctaxon>(CArchive& ar, CTaxon *taxa, INT_PTR nCount)
{
for (int i = 0; i < nCount; i++, taxa++)
{
taxa[i].Serialize(ar);
}
}
Note I commented out "
taxa->Serialize(ar);
" and replaced it with and index pointer "
taxa[i].Serialize(ar);
". However the
CFile
was, also, failing before this change.