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

📄 dlgproxy.cpp

📁 自己用MFC设计的N皇后问题演示程序
💻 CPP
字号:
// DlgProxy.cpp : implementation file
//

#include "stdafx.h"
#include "NQueen.h"
#include "DlgProxy.h"
#include "NQueenDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CNQueenDlgAutoProxy

IMPLEMENT_DYNCREATE(CNQueenDlgAutoProxy, CCmdTarget)

CNQueenDlgAutoProxy::CNQueenDlgAutoProxy()
{
	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(CNQueenDlg, AfxGetApp()->m_pMainWnd);
	m_pDialog = (CNQueenDlg*) AfxGetApp()->m_pMainWnd;
	m_pDialog->m_pAutoProxy = this;
}

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

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

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

// {FC5E8FBD-F320-42A1-A0F8-964FCB6CBF9E}
static const IID IID_INQueen =
{ 0xfc5e8fbd, 0xf320, 0x42a1, { 0xa0, 0xf8, 0x96, 0x4f, 0xcb, 0x6c, 0xbf, 0x9e } };

BEGIN_INTERFACE_MAP(CNQueenDlgAutoProxy, CCmdTarget)
	INTERFACE_PART(CNQueenDlgAutoProxy, IID_INQueen, Dispatch)
END_INTERFACE_MAP()

// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
// {449BEE84-D0F3-48EE-B161-85AA9654650E}
IMPLEMENT_OLECREATE2(CNQueenDlgAutoProxy, "NQueen.Application", 0x449bee84, 0xd0f3, 0x48ee, 0xb1, 0x61, 0x85, 0xaa, 0x96, 0x54, 0x65, 0xe)

/////////////////////////////////////////////////////////////////////////////
// CNQueenDlgAutoProxy message handlers

⌨️ 快捷键说明

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