📄 ngdocenum.cpp
字号:
////////////////////////////////////////////////////////////////
// DOCENUM Copyright 1995 Microsoft Systems Journal.
//
// CNGDocEnumerator Enumerates all the documents in an application.
// See ENUMDOC.CPP for an example of how to use it.
//
// Revised 12-18-95 for MFC 4.0 CDocManager
#include "stdafx.h"
#include "NGDocEnum.h"
//////////////////
// Construction: do rewind.
//
CNGDocEnumerator::CNGDocEnumerator()
{
Rewind();
}
//////////////////
// Rewind: start at the beginning
//
void CNGDocEnumerator::Rewind()
{
#if (_MFC_VER >= 0x0400)
m_pDocManager = AfxGetApp()->m_pDocManager;
m_posNextTemplate= m_pDocManager->GetFirstDocTemplatePosition();
#else
m_pTemplateList = &AfxGetApp()->m_templateList;
m_posNextTemplate= m_pTemplateList->GetHeadPosition();
#endif
m_pDocTemplate = NULL;
m_posNextDoc = NULL;
}
//////////////////
// GetNextDoc: translate AFX silly POSITION implementation to
// more programmer-friendly style (if you don't like it, sue me).
//
CDocument* CNGDocEnumerator::GetNextDoc()
{
if (m_posNextDoc!=NULL) {
// If there's another doc in this template, return it and advance pos
ASSERT(m_pDocTemplate);
return m_pDocTemplate->GetNextDoc(m_posNextDoc); // return it
} else if (m_posNextTemplate!=NULL) {
// If there's another doc template in the app, get its first doc
#if (_MFC_VER >= 0x400)
m_pDocTemplate = m_pDocManager->GetNextDocTemplate(m_posNextTemplate);
#else
m_pDocTemplate =
(CDocTemplate*)m_pTemplateList->GetNext(m_posNextTemplate);
#endif
m_posNextDoc = m_pDocTemplate->GetFirstDocPosition();
return GetNextDoc();
}
return NULL; // no more docs, sob sob
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -