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

📄 dlgproxy.cpp

📁 一个工程文件,在VC++里运行,就可以得到相应的工程
💻 CPP
字号:
// DlgProxy.cpp : implementation file
//

#include "stdafx.h"
#include "ex43.h"
#include "DlgProxy.h"
#include "ex43Dlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEx43DlgAutoProxy

IMPLEMENT_DYNCREATE(CEx43DlgAutoProxy, CCmdTarget)

CEx43DlgAutoProxy::CEx43DlgAutoProxy()
{
	EnableAutomation();
	
	// To keep the application running as long as an 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(CEx43Dlg, AfxGetApp()->m_pMainWnd);
	m_pDialog = (CEx43Dlg*) AfxGetApp()->m_pMainWnd;
	m_pDialog->m_pAutoProxy = this;
}

CEx43DlgAutoProxy::~CEx43DlgAutoProxy()
{
	// To terminate the application when all objects created with
	// 	with automation, the destructor calls AfxOleUnlockApp.
	//  Among other things, this will destroy the main dialog
	if (m_pDialog != NULL)
		m_pDialog->m_pAutoProxy = NULL;
	AfxOleUnlockApp();
}

void CEx43DlgAutoProxy::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(CEx43DlgAutoProxy, CCmdTarget)
	//{{AFX_MSG_MAP(CEx43DlgAutoProxy)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

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

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

// {AFCAD619-A0F8-4E04-A35D-251F64270F83}
static const IID IID_IEx43 =
{ 0xafcad619, 0xa0f8, 0x4e04, { 0xa3, 0x5d, 0x25, 0x1f, 0x64, 0x27, 0xf, 0x83 } };

BEGIN_INTERFACE_MAP(CEx43DlgAutoProxy, CCmdTarget)
	INTERFACE_PART(CEx43DlgAutoProxy, IID_IEx43, Dispatch)
END_INTERFACE_MAP()

// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
// {5B72B58B-421F-4E97-8A7D-D8FDADFAED95}
IMPLEMENT_OLECREATE2(CEx43DlgAutoProxy, "Ex43.Application", 0x5b72b58b, 0x421f, 0x4e97, 0x8a, 0x7d, 0xd8, 0xfd, 0xad, 0xfa, 0xed, 0x95)

/////////////////////////////////////////////////////////////////////////////
// CEx43DlgAutoProxy message handlers

⌨️ 快捷键说明

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