www.pudn.com > speech1.rar > DlgProxy.cpp


// DlgProxy.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Specch.h" 
#include "DlgProxy.h" 
#include "SpecchDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CSpecchDlgAutoProxy 
 
IMPLEMENT_DYNCREATE(CSpecchDlgAutoProxy, CCmdTarget) 
 
CSpecchDlgAutoProxy::CSpecchDlgAutoProxy() 
{ 
	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(CSpecchDlg, AfxGetApp()->m_pMainWnd); 
	m_pDialog = (CSpecchDlg*) AfxGetApp()->m_pMainWnd; 
	m_pDialog->m_pAutoProxy = this; 
} 
 
CSpecchDlgAutoProxy::~CSpecchDlgAutoProxy() 
{ 
	// 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 CSpecchDlgAutoProxy::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(CSpecchDlgAutoProxy, CCmdTarget) 
	//{{AFX_MSG_MAP(CSpecchDlgAutoProxy) 
		// NOTE - the ClassWizard will add and remove mapping macros here. 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
BEGIN_DISPATCH_MAP(CSpecchDlgAutoProxy, CCmdTarget) 
	//{{AFX_DISPATCH_MAP(CSpecchDlgAutoProxy) 
		// NOTE - the ClassWizard will add and remove mapping macros here. 
	//}}AFX_DISPATCH_MAP 
END_DISPATCH_MAP() 
 
// Note: we add support for IID_ISpecch to support typesafe binding 
//  from VBA.  This IID must match the GUID that is attached to the  
//  dispinterface in the .ODL file. 
 
// {A03284E7-FCFB-4263-9B45-F81EA624239D} 
static const IID IID_ISpecch = 
{ 0xa03284e7, 0xfcfb, 0x4263, { 0x9b, 0x45, 0xf8, 0x1e, 0xa6, 0x24, 0x23, 0x9d } }; 
 
BEGIN_INTERFACE_MAP(CSpecchDlgAutoProxy, CCmdTarget) 
	INTERFACE_PART(CSpecchDlgAutoProxy, IID_ISpecch, Dispatch) 
END_INTERFACE_MAP() 
 
// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project 
// {970D83D8-E6D6-43EE-BB6F-A4899548A7C3} 
IMPLEMENT_OLECREATE2(CSpecchDlgAutoProxy, "Specch.Application", 0x970d83d8, 0xe6d6, 0x43ee, 0xbb, 0x6f, 0xa4, 0x89, 0x95, 0x48, 0xa7, 0xc3) 
 
///////////////////////////////////////////////////////////////////////////// 
// CSpecchDlgAutoProxy message handlers