⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mfcdesigndoc.cpp

📁 MFC做的学生管理系统
💻 CPP
字号:
// MfcDesignDoc.cpp : implementation of the CMfcDesignDoc class
//

#include "stdafx.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMfcDesignDoc

IMPLEMENT_DYNCREATE(CMfcDesignDoc, CDocument)

BEGIN_MESSAGE_MAP(CMfcDesignDoc, CDocument)
	//{{AFX_MSG_MAP(CMfcDesignDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMfcDesignDoc construction/destruction

CMfcDesignDoc::CMfcDesignDoc()
{
	// TODO: add one-time construction code here

}

CMfcDesignDoc::~CMfcDesignDoc()
{
}

BOOL CMfcDesignDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CMfcDesignDoc serialization

void CMfcDesignDoc::Serialize(CArchive& ar)
{

	if (ar.IsStoring())  //保存
	{
		// 保存链表所有节点
		ar << m_StudentList.GetCount(); // 节点个数
		////
		POSITION pos = m_StudentList.GetHeadPosition();
		while (pos != NULL)
		{	
			CStudent* pCStudent = m_StudentList.GetAt(pos);
			ar << pCStudent; // 保存
			m_StudentList.GetNext(pos);
		}
	}
	else        //打开
	{
		
		CFile* pFile = ar.GetFile();
		m_strFileName = pFile->GetFileName();
		
		AfxMessageBox(m_strFileName);

		// 释放链表所有节点
		m_StudentList.RemoveAll();

		// 加载链表所有节点
		int nNodeCount = 0;
		ar >> nNodeCount; // 节点个数
		for (int i=0; i<nNodeCount; i++)
		{
			CStudent* pCStudent = NULL;
			ar >> pCStudent; // 加载
			m_StudentList.AddTail(pCStudent);
		}
     
		MessageBox(NULL,"dd","dd",MB_OK);
	//	CMainDlg  MainDisplay;
	//	MainDisplay.DoModal();


	}
}

/////////////////////////////////////////////////////////////////////////////
// CMfcDesignDoc diagnostics

#ifdef _DEBUG
void CMfcDesignDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CMfcDesignDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMfcDesignDoc commands

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -