StefanoCarniel
Programmer
Hello evreybody.
In my project I create a new document template, with the class CProfileDoc, CProfileView. CProfileView is derived from CFormView. The form has some control (combo box and text box) and a OK button. I need to serialize the data written in the controls when the user click the ok button. So
1) in the OnProfileOk function of CProfileView, I call a
PostMessage(WM_COMMAND, ID_FILE_SAVE);
2) this automatically recall the Serialize method of the
CProfileDoc class, but I want to recall the serialize
method of the CProfileView, because the data I want to
serialize are in the CProfileView class. So I override
the CProfileDoc::Serialize in this way
void CProfileDoc::Serialize(CArchive& ar)
{
CProfileView::Serialize( ar );
}
3) I override the serialize method of the CProfileView class
in this way
void CProfileView::Serialize(CArchive& ar)
{
CObject::Serialize( ar );
if (ar.IsStoring())
{
ar << m_final_time;
}
else
{
ar >> m_final_time;
}
}
4) I also use the directives DECLARE_SERIAL and IMPLEMENT_SERIAL in the declaration of CProfileView.
When I try to compile I got the error
error C2352: 'CProfileView::Serialize' : illegal call of non-static member function
Can you help me?
Thank you
In my project I create a new document template, with the class CProfileDoc, CProfileView. CProfileView is derived from CFormView. The form has some control (combo box and text box) and a OK button. I need to serialize the data written in the controls when the user click the ok button. So
1) in the OnProfileOk function of CProfileView, I call a
PostMessage(WM_COMMAND, ID_FILE_SAVE);
2) this automatically recall the Serialize method of the
CProfileDoc class, but I want to recall the serialize
method of the CProfileView, because the data I want to
serialize are in the CProfileView class. So I override
the CProfileDoc::Serialize in this way
void CProfileDoc::Serialize(CArchive& ar)
{
CProfileView::Serialize( ar );
}
3) I override the serialize method of the CProfileView class
in this way
void CProfileView::Serialize(CArchive& ar)
{
CObject::Serialize( ar );
if (ar.IsStoring())
{
ar << m_final_time;
}
else
{
ar >> m_final_time;
}
}
4) I also use the directives DECLARE_SERIAL and IMPLEMENT_SERIAL in the declaration of CProfileView.
When I try to compile I got the error
error C2352: 'CProfileView::Serialize' : illegal call of non-static member function
Can you help me?
Thank you