www.pudn.com > testWordAll.rar > DlgProxy.cpp
// DlgProxy.cpp : implementation file
//
#include "stdafx.h"
#include "testWordAll.h"
#include "DlgProxy.h"
#include "testWordAllDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestWordAllDlgAutoProxy
IMPLEMENT_DYNCREATE(CTestWordAllDlgAutoProxy, CCmdTarget)
CTestWordAllDlgAutoProxy::CTestWordAllDlgAutoProxy()
{
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(CTestWordAllDlg, AfxGetApp()->m_pMainWnd);
m_pDialog = (CTestWordAllDlg*) AfxGetApp()->m_pMainWnd;
m_pDialog->m_pAutoProxy = this;
}
CTestWordAllDlgAutoProxy::~CTestWordAllDlgAutoProxy()
{
// 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 CTestWordAllDlgAutoProxy::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(CTestWordAllDlgAutoProxy, CCmdTarget)
//{{AFX_MSG_MAP(CTestWordAllDlgAutoProxy)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(CTestWordAllDlgAutoProxy, CCmdTarget)
//{{AFX_DISPATCH_MAP(CTestWordAllDlgAutoProxy)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// Note: we add support for IID_ITestWordAll to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {14DA659D-92F8-436C-85A4-5312314BF4BE}
static const IID IID_ITestWordAll =
{ 0x14da659d, 0x92f8, 0x436c, { 0x85, 0xa4, 0x53, 0x12, 0x31, 0x4b, 0xf4, 0xbe } };
BEGIN_INTERFACE_MAP(CTestWordAllDlgAutoProxy, CCmdTarget)
INTERFACE_PART(CTestWordAllDlgAutoProxy, IID_ITestWordAll, Dispatch)
END_INTERFACE_MAP()
// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
// {AEECCB39-116A-4950-9F9E-72CDF68F0648}
IMPLEMENT_OLECREATE2(CTestWordAllDlgAutoProxy, "TestWordAll.Application", 0xaeeccb39, 0x116a, 0x4950, 0x9f, 0x9e, 0x72, 0xcd, 0xf6, 0x8f, 0x6, 0x48)
/////////////////////////////////////////////////////////////////////////////
// CTestWordAllDlgAutoProxy message handlers