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

📄 studoc.cpp

📁 VC++技术内幕(第四版)的实例
💻 CPP
字号:
// studoc.cpp : implementation of the CStudentDoc class
//

#include "stdafx.h"
#include "resource.h"

#include "studoc.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CStudentDoc

IMPLEMENT_DYNCREATE(CStudentDoc, CDocument)

BEGIN_MESSAGE_MAP(CStudentDoc, CDocument)
    //{{AFX_MSG_MAP(CStudentDoc)
    ON_UPDATE_COMMAND_UI(ID_FILE_SAVE, OnUpdateFileSave)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStudentDoc construction/destruction

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

CStudentDoc::~CStudentDoc()
{
}

/////////////////////////////////////////////////////////////////////////////
BOOL CStudentDoc::OnNewDocument()
{
    // generated by AppWizard
    TRACE("Entering CStudentDoc::OnNewDocument\n");
    if (!CDocument::OnNewDocument())
        return FALSE;
    return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
BOOL CStudentDoc::OnOpenDocument(const char* pszPathName)
{
    // present only to print TRACE message
    TRACE("Entering CStudentDoc::OnOpenDocument\n");
    if (!CDocument::OnOpenDocument(pszPathName))
        return FALSE;
    return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
void CStudentDoc::DeleteContents()
{
    // virtual function called by the framework when necessary
    TRACE("Entering CStudentDoc::DeleteContents\n");
    while(m_studentList.GetHeadPosition()) {
        delete m_studentList.RemoveHead();
    }
}

/////////////////////////////////////////////////////////////////////////////
// CStudentDoc serialization

void CStudentDoc::Serialize(CArchive& ar)
{
    if (ar.IsStoring())
    {
        // TODO: add storing code here for other data members
    }
    else
    {
        // TODO: add loading code here for other data members
    }
    m_studentList.Serialize(ar);
}


/////////////////////////////////////////////////////////////////////////////
// CStudentDoc diagnostics

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

void CStudentDoc::Dump(CDumpContext& dc) const
{
    CDocument::Dump(dc);
    dc << "\n" << m_studentList << "\n";
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CStudentDoc commands

void CStudentDoc::OnUpdateFileSave(CCmdUI* pCmdUI)
{
    // disable disk toolbar button if file is not modified
    pCmdUI->Enable(IsModified());
}

⌨️ 快捷键说明

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