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

📄 axserverdoc.cpp

📁 VisualC++实践与提高-ActiveX篇源码
💻 CPP
字号:
// AxServerDoc.cpp : implementation of the CAxServerDoc class
//

#include "stdafx.h"
#include "AxServer.h"

#include "AxServerDoc.h"
#include "AxServerView.h"
#include "SrvrItem.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAxServerDoc

IMPLEMENT_DYNCREATE(CAxServerDoc, COleServerDoc)

BEGIN_MESSAGE_MAP(CAxServerDoc, COleServerDoc)
	//{{AFX_MSG_MAP(CAxServerDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAxServerDoc construction/destruction
CLIPFORMAT NEAR CAxServerDoc::m_cfPrivate = NULL;

CAxServerDoc::CAxServerDoc()
{
	// Use OLE compound files
	EnableCompoundFile();

	// TODO: add one-time construction code here
	if (m_cfPrivate == NULL)
	{
		m_cfPrivate = (CLIPFORMAT)
			::RegisterClipboardFormat(_T("ActiveX服务器实例"));
	}

}

CAxServerDoc::~CAxServerDoc()
{
}

BOOL CAxServerDoc::OnNewDocument()
{
	if (!COleServerDoc::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CAxServerDoc server implementation

COleServerItem* CAxServerDoc::OnGetEmbeddedItem()
{
	// OnGetEmbeddedItem is called by the framework to get the COleServerItem
	//  that is associated with the document.  It is only called when necessary.

	CAxServerSrvrItem* pItem = new CAxServerSrvrItem(this);
	ASSERT_VALID(pItem);
	return pItem;
}



/////////////////////////////////////////////////////////////////////////////
// CAxServerDoc serialization

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

/////////////////////////////////////////////////////////////////////////////
// CAxServerDoc diagnostics

#ifdef _DEBUG
void CAxServerDoc::AssertValid() const
{
	COleServerDoc::AssertValid();
}

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

/////////////////////////////////////////////////////////////////////////////
// CAxServerDoc commands

COleServerItem* CAxServerDoc::OnGetLinkedItem(LPCTSTR lpszItemName) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	COleServerItem* pItem=COleServerDoc::OnGetLinkedItem(lpszItemName);
	
	if(pItem!=NULL)
		return pItem;
	else
	{
		//	添加自己的搜索代码

		return pItem;
	}
}

void CAxServerDoc::OnSetItemRects(LPCRECT lpPosRect, LPCRECT lpClipRect) 
{
	// TODO: Add your specialized code here and/or call the base class
	// 得到与当前文档相关联的第一个视
	POSITION pos = GetFirstViewPosition();
	ASSERT(pos != NULL);
	CAxServerView* pView = (CAxServerView*)GetNextView(pos);
	ASSERT_KINDOF(CAxServerView, pView);
	ASSERT_VALID(pView);

	// 得到视的设备情景对象
	CClientDC dc(pView);
	// 设置缩放比例为100%
	dc.SetViewportExt(CSize(1,1));
	dc.SetWindowExt(CSize(1,1));

	// 重新设置编辑窗口大小
	COleServerDoc::OnSetItemRects(lpPosRect, lpClipRect);
}

void CAxServerDoc::Draw(CDC* pDC)
{
	pDC->Rectangle(10,10,100,100);
}

⌨️ 快捷键说明

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