我想把对话框上的数据,保存到一个基类为CObject的类中,请问如何保存?

解决方案 »

  1.   

    class CSaveData : public CObject
    {
    public:
    CSaveData ();
    void Serialize( CArchive& archive );   DECLARE_SERIAL(CSaveData)
    private:
    // saved data
    ...
    };
      

  2.   

    我就是不知道,怎么把对话框中的一些变量,放到这个CSaveData这个类中
      

  3.   

    void CSaveData::Serialize( CArchive& ar )
     {
     CObject::Serialize( ar );
         if( ar.IsStoring() )
         ar << m_years;
         else
         ar >> m_years;
     }
      

  4.   

    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