class CSaveData : public CObject { public: CSaveData (); void Serialize( CArchive& archive ); DECLARE_SERIAL(CSaveData) private: // saved data ... };
我就是不知道,怎么把对话框中的一些变量,放到这个CSaveData这个类中
void CSaveData::Serialize( CArchive& ar ) { CObject::Serialize( ar ); if( ar.IsStoring() ) ar << m_years; else ar >> m_years; }
You must also use the DECLARE_SERIAL macro in your class declaration, and you must use the IMPLEMENT_SERIAL macro in the implementation.Use CArchive::IsLoading or CArchive::IsStoring to determine whether the archive is loading or storing
{
public:
CSaveData ();
void Serialize( CArchive& archive ); DECLARE_SERIAL(CSaveData)
private:
// saved data
...
};
{
CObject::Serialize( ar );
if( ar.IsStoring() )
ar << m_years;
else
ar >> m_years;
}