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

📄 mydoc.cpp

📁 随着计算机信息技术的飞速发展
💻 CPP
字号:
  // MyDoc.cpp : implementation file
//

#include "stdafx.h"
//#include "	\ add additional includes here"
#include "MyDoc.h"
#include "MyView.h"
#include "WndForDLL.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyDoc

IMPLEMENT_DYNCREATE(CMyDoc, CDocument)

CMyDoc::CMyDoc()
{
	m_dllList.RemoveAll();
}

BOOL CMyDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;
	return TRUE;
}

CMyDoc::~CMyDoc()
{
}


BEGIN_MESSAGE_MAP(CMyDoc, CDocument)
	//{{AFX_MSG_MAP(CMyDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CMyDoc serialization

void CMyDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CMyDoc commands

LRESULT CMyDoc::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	CWndForDLL*	pWndDll = NULL;
	POSITION position	= m_dllList.GetHeadPosition();

	while(position != NULL)
	{
		pWndDll = (CWndForDLL *)m_dllList.GetAt(position);
		m_dllList.GetNext(position);
		pWndDll->WindowProc(message, wParam, lParam) ;
	}
	return TRUE;
}



BOOL CMyDoc::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) 
{
	// TODO: Add your specialized code here and/or call the base class
	POSITION position = m_dllList.GetHeadPosition();
	
	CWndForDLL*	pWndDll = NULL;
	BOOL bTrue = FALSE;
	while(position != NULL)
	{
		pWndDll = (CWndForDLL*)m_dllList.GetAt(position);
		m_dllList.GetNext(position);
		
		bTrue = pWndDll->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
		if(bTrue)
			return bTrue;
	}
	
	return CDocument::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}


BOOL CMyDoc::OpenProject()
{
	UpdateAllViews(NULL, 0, NULL);
	return TRUE;
}

void CMyDoc::ReleaseDll(CString dllfunname)
{
	//CPtrList m_dllList;
	//(pDoc->m_dllList).AddTail(this);
	POSITION position = m_dllList.GetHeadPosition();
	while(position != NULL)
	{
		CWndForDLL* pWndDll = (CWndForDLL*)m_dllList.GetAt(position);
		if(pWndDll->m_funName == dllfunname)
		{	
			m_dllList.RemoveAt(position);
		//	pWndDll->UnsubclassWindow();
			delete pWndDll;          //zxy 98.12.10
			break;
			
		}
		m_dllList.GetNext(position);
	}
}



void CMyDoc::OnCloseDocument() 
{
	// TODO: Add your specialized code here and/or call the base class
	POSITION position = m_dllList.GetHeadPosition();
	while(position != NULL)
	{
		CWndForDLL* pWndDll= (CWndForDLL*)m_dllList.GetNext(position);
//		pWndDll->UnsubclassWindow();
		delete pWndDll;
	}
	m_dllList.RemoveAll();
	
	CDocument::OnCloseDocument();
}

⌨️ 快捷键说明

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