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


// DlgProxy.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "FrameGrabber.h" 
#include "DlgProxy.h" 
#include "FrameGrabberDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CFrameGrabberDlgAutoProxy 
 
IMPLEMENT_DYNCREATE(CFrameGrabberDlgAutoProxy, CCmdTarget) 
 
CFrameGrabberDlgAutoProxy::CFrameGrabberDlgAutoProxy() 
{ 
	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(CFrameGrabberDlg, AfxGetApp()->m_pMainWnd); 
	m_pDialog = (CFrameGrabberDlg*) AfxGetApp()->m_pMainWnd; 
	m_pDialog->m_pAutoProxy = this; 
} 
 
CFrameGrabberDlgAutoProxy::~CFrameGrabberDlgAutoProxy() 
{ 
	// 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 CFrameGrabberDlgAutoProxy::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(CFrameGrabberDlgAutoProxy, CCmdTarget) 
	//{{AFX_MSG_MAP(CFrameGrabberDlgAutoProxy) 
		// NOTE - the ClassWizard will add and remove mapping macros here. 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
BEGIN_DISPATCH_MAP(CFrameGrabberDlgAutoProxy, CCmdTarget) 
	//{{AFX_DISPATCH_MAP(CFrameGrabberDlgAutoProxy) 
		// NOTE - the ClassWizard will add and remove mapping macros here. 
	//}}AFX_DISPATCH_MAP 
END_DISPATCH_MAP() 
 
// Note: we add support for IID_IFrameGrabber to support typesafe binding 
//  from VBA.  This IID must match the GUID that is attached to the  
//  dispinterface in the .ODL file. 
 
// {0D377ACC-A3FC-4E1D-BAE4-252853D9080D} 
static const IID IID_IFrameGrabber = 
{ 0xd377acc, 0xa3fc, 0x4e1d, { 0xba, 0xe4, 0x25, 0x28, 0x53, 0xd9, 0x8, 0xd } }; 
 
BEGIN_INTERFACE_MAP(CFrameGrabberDlgAutoProxy, CCmdTarget) 
	INTERFACE_PART(CFrameGrabberDlgAutoProxy, IID_IFrameGrabber, Dispatch) 
END_INTERFACE_MAP() 
 
// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project 
// {C16FBF77-0C66-476E-8C78-15BE5AE14306} 
IMPLEMENT_OLECREATE2(CFrameGrabberDlgAutoProxy, "FrameGrabber.Application", 0xc16fbf77, 0xc66, 0x476e, 0x8c, 0x78, 0x15, 0xbe, 0x5a, 0xe1, 0x43, 0x6) 
 
///////////////////////////////////////////////////////////////////////////// 
// CFrameGrabberDlgAutoProxy message handlers