// DlgProxy.cpp : implementation file // #include "stdafx.h" #include "MFCclient.h" #include "DlgProxy.h" #include "MFCclientDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMFCclientDlgAutoProxy IMPLEMENT_DYNCREATE(CMFCclientDlgAutoProxy, CCmdTarget) CMFCclientDlgAutoProxy::CMFCclientDlgAutoProxy() { 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(CMFCclientDlg, AfxGetApp()->m_pMainWnd); m_pDialog = (CMFCclientDlg*) AfxGetApp()->m_pMainWnd; m_pDialog->m_pAutoProxy = this; } CMFCclientDlgAutoProxy::~CMFCclientDlgAutoProxy() { // 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 CMFCclientDlgAutoProxy::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(CMFCclientDlgAutoProxy, CCmdTarget) //{{AFX_MSG_MAP(CMFCclientDlgAutoProxy) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CMFCclientDlgAutoProxy, CCmdTarget) //{{AFX_DISPATCH_MAP(CMFCclientDlgAutoProxy) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_DISPATCH_MAP END_DISPATCH_MAP() // Note: we add support for IID_IMFCclient to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .ODL file. // {D49292CD-0317-11D4-8EF7-C4F315000000} static const IID IID_IMFCclient = { 0xd49292cd, 0x317, 0x11d4, { 0x8e, 0xf7, 0xc4, 0xf3, 0x15, 0x0, 0x0, 0x0 } }; BEGIN_INTERFACE_MAP(CMFCclientDlgAutoProxy, CCmdTarget) INTERFACE_PART(CMFCclientDlgAutoProxy, IID_IMFCclient, Dispatch) END_INTERFACE_MAP() // The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project // {D49292CB-0317-11D4-8EF7-C4F315000000} IMPLEMENT_OLECREATE2( CMFCclientDlgAutoProxy, "MFCclient.Application", 0xd49292cb, 0x317, 0x11d4, 0x8e, 0xf7, 0xc4, 0xf3, 0x15, 0x0, 0x0, 0x0 ) ///////////////////////////////////////////////////////////////////////////// // CMFCclientDlgAutoProxy message handlers