www.gusucode.com > VC++酒店业务管理系统源程序代码-源码程序 > VC++酒店业务管理系统源程序代码-源码程序\code\代码\DlgProxy.cpp

    // DlgProxy.cpp : implementation file
// Download by http://www.NewXing.com

#include "stdafx.h"
#include "RMS.h"
#include "DlgProxy.h"
#include "RMSDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CRMSDlgAutoProxy

IMPLEMENT_DYNCREATE(CRMSDlgAutoProxy, CCmdTarget)

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

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

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

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

// {63582363-3759-43D1-ADFD-8000F80FA360}
static const IID IID_IRMS =
{ 0x63582363, 0x3759, 0x43d1, { 0xad, 0xfd, 0x80, 0x0, 0xf8, 0xf, 0xa3, 0x60 } };

BEGIN_INTERFACE_MAP(CRMSDlgAutoProxy, CCmdTarget)
	INTERFACE_PART(CRMSDlgAutoProxy, IID_IRMS, Dispatch)
END_INTERFACE_MAP()

// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
// {3BA5CF11-5659-47C4-9184-44A1C8828BAC}
IMPLEMENT_OLECREATE2(CRMSDlgAutoProxy, "RMS.Application", 0x3ba5cf11, 0x5659, 0x47c4, 0x91, 0x84, 0x44, 0xa1, 0xc8, 0x82, 0x8b, 0xac)

/////////////////////////////////////////////////////////////////////////////
// CRMSDlgAutoProxy message handlers