// DlgProxy.cpp : implementation file
//

#include "stdafx.h"
#include "Dashboard.h"
#include "DlgProxy.h"
#include "DashboardDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDashboardDlgAutoProxy

IMPLEMENT_DYNCREATE(CDashboardDlgAutoProxy, CCmdTarget)

CDashboardDlgAutoProxy::CDashboardDlgAutoProxy()
{
	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(CDashboardDlg, AfxGetApp()->m_pMainWnd);
	m_pDialog = (CDashboardDlg*) AfxGetApp()->m_pMainWnd;
	m_pDialog->m_pAutoProxy = this;
}

CDashboardDlgAutoProxy::~CDashboardDlgAutoProxy()
{
	// 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 CDashboardDlgAutoProxy::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(CDashboardDlgAutoProxy, CCmdTarget)
	//{{AFX_MSG_MAP(CDashboardDlgAutoProxy)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CDashboardDlgAutoProxy, CCmdTarget)
	//{{AFX_DISPATCH_MAP(CDashboardDlgAutoProxy)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IDashboard to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {288C874D-4E02-4A1A-AD07-82BDEB1AC46B}
static const IID IID_IDashboard =
{ 0x288c874d, 0x4e02, 0x4a1a, { 0xad, 0x7, 0x82, 0xbd, 0xeb, 0x1a, 0xc4, 0x6b } };

BEGIN_INTERFACE_MAP(CDashboardDlgAutoProxy, CCmdTarget)
	INTERFACE_PART(CDashboardDlgAutoProxy, IID_IDashboard, Dispatch)
END_INTERFACE_MAP()

// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
// {3510541A-56D6-4E44-ABD7-C7690DDB0FFE}
IMPLEMENT_OLECREATE2(CDashboardDlgAutoProxy, "Dashboard.Application", 0x3510541a, 0x56d6, 0x4e44, 0xab, 0xd7, 0xc7, 0x69, 0xd, 0xdb, 0xf, 0xfe)

/////////////////////////////////////////////////////////////////////////////
// CDashboardDlgAutoProxy message handlers
