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

📄 dlgproxy.cpp

📁 Visual C++ From the Ground Up Second Edition 例程源代码
💻 CPP
字号:
// DlgProxy.cpp : implementation file
//

#include "stdafx.h"
#include "DAO2.h"
#include "DlgProxy.h"
#include "DAO2Dlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDAO2DlgAutoProxy

IMPLEMENT_DYNCREATE(CDAO2DlgAutoProxy, CCmdTarget)

CDAO2DlgAutoProxy::CDAO2DlgAutoProxy()
{
	EnableAutomation();
	
	// To keep the application running as long as an OLE automation 
	//	object is active, the constructor calls AfxOleLockApp.
	AfxOleLockApp();

	// Get access to the dialog through the application's
	//  main window pointer.  Set the proxy's internal pointer
	//  to point to the dialog, and set the dialog's back pointer to
	//  this proxy.
	ASSERT (AfxGetApp()->m_pMainWnd != NULL);
	ASSERT_VALID (AfxGetApp()->m_pMainWnd);
	ASSERT_KINDOF(CDAO2Dlg, AfxGetApp()->m_pMainWnd);
	m_pDialog = (CDAO2Dlg*) AfxGetApp()->m_pMainWnd;
	m_pDialog->m_pAutoProxy = this;
}

CDAO2DlgAutoProxy::~CDAO2DlgAutoProxy()
{
	// To terminate the application when all objects created with
	// 	with OLE automation, the destructor calls AfxOleUnlockApp.
	//  Among other things, this will destroy the main dialog
	AfxOleUnlockApp();
}

void CDAO2DlgAutoProxy::OnFinalRelease()
{
	// When the last reference for an automation object is released
	// OnFinalRelease is called.  The base class will automatically
	// deletes the object.  Add additional cleanup required for your
	// object before calling the base class.

	CCmdTarget::OnFinalRelease();
}

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

BEGIN_DISPATCH_MAP(CDAO2DlgAutoProxy, CCmdTarget)
	//{{AFX_DISPATCH_MAP(CDAO2DlgAutoProxy)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

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

// {E0C11C85-A206-11D0-9887-00A024DA5F0B}
static const IID IID_IDAO2 =
{ 0xe0c11c85, 0xa206, 0x11d0, { 0x98, 0x87, 0x0, 0xa0, 0x24, 0xda, 0x5f, 0xb } };

BEGIN_INTERFACE_MAP(CDAO2DlgAutoProxy, CCmdTarget)
	INTERFACE_PART(CDAO2DlgAutoProxy, IID_IDAO2, Dispatch)
END_INTERFACE_MAP()

// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
// {E0C11C83-A206-11D0-9887-00A024DA5F0B}
IMPLEMENT_OLECREATE2(CDAO2DlgAutoProxy, "DAO2.Application", 0xe0c11c83, 0xa206, 0x11d0, 0x98, 0x87, 0x0, 0xa0, 0x24, 0xda, 0x5f, 0xb)

/////////////////////////////////////////////////////////////////////////////
// CDAO2DlgAutoProxy message handlers

⌨️ 快捷键说明

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