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

📄 asdoc.cpp

📁 《VC++ 编程技巧与示例 .rar》各个示例代码绝对可用
💻 CPP
字号:
// ASDoc.cpp : implementation of the CASDoc class
//

#include "stdafx.h"
#include "AS.h"

#include "ASDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CASDoc

IMPLEMENT_DYNCREATE(CASDoc, CDocument)

BEGIN_MESSAGE_MAP(CASDoc, CDocument)
	//{{AFX_MSG_MAP(CASDoc)
		// 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()

BEGIN_DISPATCH_MAP(CASDoc, CDocument)
	//{{AFX_DISPATCH_MAP(CASDoc)
	DISP_PROPERTY_EX(CASDoc, "LargerNumber", GetLargerNumber, SetLargerNumber, VT_R8)
	DISP_FUNCTION(CASDoc, "Sort", Sort, VT_R8, VTS_R8 VTS_R8)
	DISP_FUNCTION(CASDoc, "ShowWindow", ShowWindow, VT_EMPTY, VTS_NONE)
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IAS to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {F673CC45-C2F0-11D3-9462-0000000038B2}
static const IID IID_IAS =
{ 0xf673cc45, 0xc2f0, 0x11d3, { 0x94, 0x62, 0x0, 0x0, 0x0, 0x0, 0x38, 0xb2 } };

BEGIN_INTERFACE_MAP(CASDoc, CDocument)
	INTERFACE_PART(CASDoc, IID_IAS, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CASDoc construction/destruction

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

	EnableAutomation();

	AfxOleLockApp();
}

CASDoc::~CASDoc()
{
	AfxOleUnlockApp();
}

BOOL CASDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

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

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CASDoc serialization

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

/////////////////////////////////////////////////////////////////////////////
// CASDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CASDoc commands
//●:
double CASDoc::Sort(double x0, double x1) 
{
	// TODO: Add your dispatch handler code here
	double t;
	if(x0>x1)
	{
		t=x0;
		x0=x1;
		x1=t;
	}
	m_LargerNumber=x1;
	UpdateAllViews(NULL);
	return x1;
}

double CASDoc::GetLargerNumber() 
{
	// TODO: Add your property handler here
	return m_LargerNumber;
}

void CASDoc::SetLargerNumber(double newValue) 
{
	// TODO: Add your property handler here
	m_LargerNumber=newValue;
	UpdateAllViews(NULL);
}

void CASDoc::ShowWindow() 
{
	// TODO: Add your dispatch handler code here
    POSITION position = GetFirstViewPosition();
    CView* pView = GetNextView(position);
    // If the window exists...
    if (pView != NULL)
    {
        // Get a pointer to the frame window.
        CMDIChildWnd* pCldFrameWnd =(CMDIChildWnd *)pView->GetParentFrame();
		CMDIFrameWnd* pFrameWnd = (CMDIFrameWnd* )pCldFrameWnd->GetParentFrame();
        // Show the frame window.
        pFrameWnd->ActivateFrame(SW_SHOW);
		pCldFrameWnd->ActivateFrame(SW_SHOW);
    }
}

⌨️ 快捷键说明

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