📄 dlgproxy.cpp
字号:
// DlgProxy.cpp : implementation file
//
#include "stdafx.h"
#include "MyPrinter.h"
#include "DlgProxy.h"
#include "MyPrinterDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyPrinterDlgAutoProxy
IMPLEMENT_DYNCREATE(CMyPrinterDlgAutoProxy, CCmdTarget)
CMyPrinterDlgAutoProxy::CMyPrinterDlgAutoProxy()
{
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(CMyPrinterDlg, AfxGetApp()->m_pMainWnd);
m_pDialog = (CMyPrinterDlg*) AfxGetApp()->m_pMainWnd;
m_pDialog->m_pAutoProxy = this;
}
CMyPrinterDlgAutoProxy::~CMyPrinterDlgAutoProxy()
{
// 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 CMyPrinterDlgAutoProxy::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(CMyPrinterDlgAutoProxy, CCmdTarget)
//{{AFX_MSG_MAP(CMyPrinterDlgAutoProxy)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(CMyPrinterDlgAutoProxy, CCmdTarget)
//{{AFX_DISPATCH_MAP(CMyPrinterDlgAutoProxy)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// Note: we add support for IID_IMyPrinter to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {DBA72CCC-C2A9-4832-975F-A2DF633A4F02}
static const IID IID_IMyPrinter =
{ 0xdba72ccc, 0xc2a9, 0x4832, { 0x97, 0x5f, 0xa2, 0xdf, 0x63, 0x3a, 0x4f, 0x2 } };
BEGIN_INTERFACE_MAP(CMyPrinterDlgAutoProxy, CCmdTarget)
INTERFACE_PART(CMyPrinterDlgAutoProxy, IID_IMyPrinter, Dispatch)
END_INTERFACE_MAP()
// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
// {4ABAA35D-959D-470D-BB3E-281C58629224}
IMPLEMENT_OLECREATE2(CMyPrinterDlgAutoProxy, "MyPrinter.Application", 0x4abaa35d, 0x959d, 0x470d, 0xbb, 0x3e, 0x28, 0x1c, 0x58, 0x62, 0x92, 0x24)
/////////////////////////////////////////////////////////////////////////////
// CMyPrinterDlgAutoProxy message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -