[!if RIBBON_TOOLBAR] // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface // (the "Fluent UI") and is provided only as referential material to supplement the // Microsoft Foundation Classes Reference and related electronic documentation // included with the MFC C++ library software. // License terms to copy, use or distribute the Fluent UI are available separately. // To learn more about our Fluent UI licensing program, please visit // https://go.microsoft.com/fwlink/?LinkId=238214. // // Copyright (C) Microsoft Corporation // All rights reserved. [!endif] // $dialogautoproxyimpl$ : implementation file // #include "pch.h" #include "framework.h" #include "$appheader$" #include "$dialogautoproxyheader$" #include "$dialogheader$" #ifdef _DEBUG #define new DEBUG_NEW #endif // $dialogautoproxyclass$ IMPLEMENT_DYNCREATE($dialogautoproxyclass$, $dialogautoproxybaseclass$) $dialogautoproxyclass$::$dialogautoproxyclass$() { 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($dialogclass$, AfxGetApp()->m_pMainWnd); if (AfxGetApp()->m_pMainWnd->IsKindOf(RUNTIME_CLASS($dialogclass$))) { m_pDialog = reinterpret_cast<$dialogclass$*>(AfxGetApp()->m_pMainWnd); m_pDialog->m_pAutoProxy = this; } } } $dialogautoproxyclass$::~$dialogautoproxyclass$() { // 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 != nullptr) m_pDialog->m_pAutoProxy = nullptr; AfxOleUnlockApp(); } void $dialogautoproxyclass$::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. $dialogautoproxybaseclass$::OnFinalRelease(); } BEGIN_MESSAGE_MAP($dialogautoproxyclass$, $dialogautoproxybaseclass$) END_MESSAGE_MAP() BEGIN_DISPATCH_MAP($dialogautoproxyclass$, $dialogautoproxybaseclass$) END_DISPATCH_MAP() // Note: we add support for IID_I$safeprojectidentifiername$ to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .IDL file. // {$guid_disp_iid$} static const IID IID_I$safeprojectidentifiername$ = $guid_disp_iid_staticconst$; BEGIN_INTERFACE_MAP($dialogautoproxyclass$, $dialogautoproxybaseclass$) INTERFACE_PART($dialogautoproxyclass$, IID_I$safeprojectidentifiername$, Dispatch) END_INTERFACE_MAP() // The IMPLEMENT_OLECREATE2 macro is defined in pch.h of this project // {$guid_app_clsid$} IMPLEMENT_OLECREATE2($dialogautoproxyclass$, "$safeprojectidentifiername$.Application", $guid_app_clsid_olecreate$) // $dialogautoproxyclass$ message handlers