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

📄 lsingledoctemplate.cpp

📁 这是一个管理信息系统
💻 CPP
字号:
// LSingleDocTemplate.cpp: implementation of the LSingleDocTemplate class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "a1.h"
#include "LSingleDocTemplate.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

LSingleDocTemplate::LSingleDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass):	CSingleDocTemplate(nIDResource, pDocClass,
 pFrameClass,  pViewClass)
{
m_wndparent=NULL;
m_frame=NULL;
}

LSingleDocTemplate::~LSingleDocTemplate()
{

}

CFrameWnd* LSingleDocTemplate::CreateNewFrame(CDocument *pDoc, CFrameWnd *pOther)
{
	if (pDoc != NULL)
		ASSERT_VALID(pDoc);
	// create a frame wired to the specified document

	ASSERT(m_nIDResource != 0); // must have a resource ID to load from
	CCreateContext context;
	context.m_pCurrentFrame = pOther;
	context.m_pCurrentDoc = pDoc;
	context.m_pNewViewClass = m_pViewClass;
	context.m_pNewDocTemplate = this;

	if (m_pFrameClass == NULL)
	{
		TRACE0("Error: you must override CDocTemplate::CreateNewFrame.\n");
		ASSERT(FALSE);
		return NULL;
	}
	CFrameWnd* pFrame = (CFrameWnd*)m_pFrameClass->CreateObject();
	if (pFrame == NULL)
	{
		TRACE1("Warning: Dynamic create of frame %hs failed.\n",
			m_pFrameClass->m_lpszClassName);
		return NULL;
	}
	ASSERT_KINDOF(CFrameWnd, pFrame);

	if (context.m_pNewViewClass == NULL)
		TRACE0("Warning: creating frame with no default view.\n");

	// create new from resource
	if (!pFrame->LoadFrame(m_nIDResource,
		WS_OVERLAPPEDWINDOW|FWS_ADDTOTITLE ,//| ,   // default frame styles
	m_wndparent, &context))//
	{
		TRACE0("Warning: CDocTemplate couldn't create a frame.\n");
		// frame will be deleted in PostNcDestroy cleanup
		return NULL;
	}
	this->m_frame=(CMyFrame*)pFrame;

	if(m_wndparent!=NULL)
	{
	ASSERT_KINDOF(CWnd,m_wndparent);
	CRect rect;
	m_wndparent->GetWindowRect(rect);
	m_frame->MoveWindow(&rect);
	}
	// it worked !
	return pFrame;
}

void LSingleDocTemplate::SetFrameParent(CWnd *parent)
{
this->m_wndparent=parent;
}



CMyFrame* LSingleDocTemplate::GetMyFrame() const
{
	ASSERT(m_frame!=NULL);
	ASSERT_KINDOF(CMyFrame,m_frame);
	return this->m_frame;
}

⌨️ 快捷键说明

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