readme.wzd

来自「《Visual C++ MFC编程实例》配套代码,如果大家正在学习此教程」· WZD 代码 · 共 63 行

WZD
63
字号
/////////////////////////////////////////////////////////////////////
// Example files.
/////////////////////////////////////////////////////////////////////

WzdInfo1.cpp -- sample data classes that have been enabled to be serialized
WzdInfo1.h
WzdInfo2.cpp
WzdInfo2.h

/////////////////////////////////////////////////////////////////////
// Modify the Document Class.
/////////////////////////////////////////////////////////////////////

// 1) from this class's Serialize() function, call the Serialize() functions
// of all data classes you wish to serialize to disk
void CWzdDoc::Serialize(CArchive& ar)
{
	int nCount;
	if (ar.IsStoring())
	{
		nCount = m_WzdInfo1List.GetCount();
		ar << nCount;
		for (POSITION pos = m_WzdInfo1List.GetHeadPosition(); pos; )
		{
			CWzdInfo1 *pInfo = m_WzdInfo1List.GetNext(pos);
			pInfo->Serialize(ar);
		}
	}
	else
	{
		ar >> nCount;
		while (nCount-- > 0)
		{
			CWzdInfo1* pInfo = new CWzdInfo1;
			pInfo->Serialize(ar);
			m_WzdInfo1List.AddTail(pInfo);
		}
	}
}


// 2) also implement this class's DeleteContents() function to delete any objects
// maintained by this class. This function is called with "New" and "Open" menu
// commands
void CWzdDoc::DeleteContents() 
{
	// called with new and open document
	// opportunity to initialize the data collections that make up our document
	while (!m_WzdInfo1List.IsEmpty())
	{
		delete m_WzdInfo1List.RemoveHead();
	}


	CDocument::DeleteContents();
}

/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1998 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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