dlgproxy.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:3k
- // [!output DIALOG_AUTO_PROXY_IMPL] : implementation file
- //
- #include "stdafx.h"
- #include "[!output APP_HEADER]"
- #include "[!output DIALOG_AUTO_PROXY_HEADER]"
- #include "[!output DIALOG_HEADER]"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- // [!output DIALOG_AUTO_PROXY_CLASS]
- IMPLEMENT_DYNCREATE([!output DIALOG_AUTO_PROXY_CLASS], [!output DIALOG_AUTO_PROXY_BASE_CLASS])
- [!output DIALOG_AUTO_PROXY_CLASS]::[!output DIALOG_AUTO_PROXY_CLASS]()
- {
- 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_VALID(AfxGetApp()->m_pMainWnd);
- if (AfxGetApp()->m_pMainWnd)
- {
- ASSERT_KINDOF([!output DIALOG_CLASS], AfxGetApp()->m_pMainWnd);
- if (AfxGetApp()->m_pMainWnd->IsKindOf(RUNTIME_CLASS([!output DIALOG_CLASS])))
- {
- m_pDialog = reinterpret_cast<[!output DIALOG_CLASS]*>(AfxGetApp()->m_pMainWnd);
- m_pDialog->m_pAutoProxy = this;
- }
- }
- }
- [!output DIALOG_AUTO_PROXY_CLASS]::~[!output DIALOG_AUTO_PROXY_CLASS]()
- {
- // 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 [!output DIALOG_AUTO_PROXY_CLASS]::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.
- [!output DIALOG_AUTO_PROXY_BASE_CLASS]::OnFinalRelease();
- }
- BEGIN_MESSAGE_MAP([!output DIALOG_AUTO_PROXY_CLASS], [!output DIALOG_AUTO_PROXY_BASE_CLASS])
- END_MESSAGE_MAP()
- BEGIN_DISPATCH_MAP([!output DIALOG_AUTO_PROXY_CLASS], [!output DIALOG_AUTO_PROXY_BASE_CLASS])
- END_DISPATCH_MAP()
- // Note: we add support for IID_I[!output SAFE_PROJECT_IDENTIFIER_NAME] to support typesafe binding
- // from VBA. This IID must match the GUID that is attached to the
- // dispinterface in the .IDL file.
- // {[!output DISPIID_REGISTRY_FORMAT]}
- static const IID IID_I[!output SAFE_PROJECT_IDENTIFIER_NAME] =
- [!output DISPIID_STATIC_CONST_GUID_FORMAT];
- BEGIN_INTERFACE_MAP([!output DIALOG_AUTO_PROXY_CLASS], [!output DIALOG_AUTO_PROXY_BASE_CLASS])
- INTERFACE_PART([!output DIALOG_AUTO_PROXY_CLASS], IID_I[!output SAFE_PROJECT_IDENTIFIER_NAME], Dispatch)
- END_INTERFACE_MAP()
- // The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
- // {[!output APP_CLSID_REGISTRY_FORMAT]}
- IMPLEMENT_OLECREATE2([!output DIALOG_AUTO_PROXY_CLASS], "[!output SAFE_PROJECT_IDENTIFIER_NAME].Application", [!output APP_CLSID_IMPLEMENT_OLECREATE_FORMAT])
- // [!output DIALOG_AUTO_PROXY_CLASS] message handlers