home *** CD-ROM | disk | FTP | other *** search
/ distrib.akp.su/Programming/Vb-6+Rus/ / distrib.akp.su.tar / distrib.akp.su / Programming / Vb-6+Rus / COMMON / MSDEV98 / BIN / IDE / MFCAPWZ.DLL / TEMPLATE / DLGPROXY.CPP < prev    next >
C/C++ Source or Header  |  1998-06-18  |  3KB  |  97 lines

  1. // $$dlgautoproxy_ifile$$.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "$$root$$.h"
  6. #include "$$dlgautoproxy_hfile$$.h"
  7. #include "$$dlg_hfile$$.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // $$DLGAUTOPROXY_CLASS$$
  17.  
  18. IMPLEMENT_DYNCREATE($$DLGAUTOPROXY_CLASS$$, $$DLGAUTOPROXY_BASE_CLASS$$)
  19.  
  20. $$DLGAUTOPROXY_CLASS$$::$$DLGAUTOPROXY_CLASS$$()
  21. {
  22.     EnableAutomation();
  23.     
  24.     // To keep the application running as long as an automation 
  25.     //    object is active, the constructor calls AfxOleLockApp.
  26.     AfxOleLockApp();
  27.  
  28. $$IF(VERBOSE)
  29.     // Get access to the dialog through the application's
  30.     //  main window pointer.  Set the proxy's internal pointer
  31.     //  to point to the dialog, and set the dialog's back pointer to
  32.     //  this proxy.
  33. $$ENDIF //VERBOSE
  34.     ASSERT (AfxGetApp()->m_pMainWnd != NULL);
  35.     ASSERT_VALID (AfxGetApp()->m_pMainWnd);
  36.     ASSERT_KINDOF($$DLG_CLASS$$, AfxGetApp()->m_pMainWnd);
  37.     m_pDialog = ($$DLG_CLASS$$*) AfxGetApp()->m_pMainWnd;
  38.     m_pDialog->m_pAutoProxy = this;
  39. }
  40.  
  41. $$DLGAUTOPROXY_CLASS$$::~$$DLGAUTOPROXY_CLASS$$()
  42. {
  43. $$IF(VERBOSE)
  44.     // To terminate the application when all objects created with
  45.     //     with automation, the destructor calls AfxOleUnlockApp.
  46.     //  Among other things, this will destroy the main dialog
  47. $$ENDIF //VERBOSE
  48.     if (m_pDialog != NULL)
  49.         m_pDialog->m_pAutoProxy = NULL;
  50.     AfxOleUnlockApp();
  51. }
  52.  
  53. void $$DLGAUTOPROXY_CLASS$$::OnFinalRelease()
  54. {
  55. $$IF(VERBOSE)
  56.     // When the last reference for an automation object is released
  57.     // OnFinalRelease is called.  The base class will automatically
  58.     // deletes the object.  Add additional cleanup required for your
  59.     // object before calling the base class.
  60.  
  61. $$ENDIF //VERBOSE
  62.     $$DLGAUTOPROXY_BASE_CLASS$$::OnFinalRelease();
  63. }
  64.  
  65. BEGIN_MESSAGE_MAP($$DLGAUTOPROXY_CLASS$$, $$DLGAUTOPROXY_BASE_CLASS$$)
  66.     //{{AFX_MSG_MAP($$DLGAUTOPROXY_CLASS$$)
  67.         // NOTE - the ClassWizard will add and remove mapping macros here.
  68.     //}}AFX_MSG_MAP
  69. END_MESSAGE_MAP()
  70.  
  71. BEGIN_DISPATCH_MAP($$DLGAUTOPROXY_CLASS$$, $$DLGAUTOPROXY_BASE_CLASS$$)
  72.     //{{AFX_DISPATCH_MAP($$DLGAUTOPROXY_CLASS$$)
  73.         // NOTE - the ClassWizard will add and remove mapping macros here.
  74.     //}}AFX_DISPATCH_MAP
  75. END_DISPATCH_MAP()
  76.  
  77. // Note: we add support for IID_I$$Safe_root$$ to support typesafe binding
  78. //  from VBA.  This IID must match the GUID that is attached to the 
  79. //  dispinterface in the .ODL file.
  80.  
  81. // {$$DISPIID_CLSID_ODL$$}
  82. static const IID IID_I$$Safe_root$$ =
  83. $$DISPIID_CLSID$$;
  84.  
  85. BEGIN_INTERFACE_MAP($$DLGAUTOPROXY_CLASS$$, $$DLGAUTOPROXY_BASE_CLASS$$)
  86.     INTERFACE_PART($$DLGAUTOPROXY_CLASS$$, IID_I$$Safe_root$$, Dispatch)
  87. END_INTERFACE_MAP()
  88.  
  89. $$IF(VERBOSE)
  90. // The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
  91. $$ENDIF //VERBOSE
  92. // {$$APP_CLSID_REG$$}
  93. IMPLEMENT_OLECREATE2($$DLGAUTOPROXY_CLASS$$, "$$Safe_root$$.Application", $$APP_CLSID_MACRO$$)
  94.  
  95. /////////////////////////////////////////////////////////////////////////////
  96. // $$DLGAUTOPROXY_CLASS$$ message handlers
  97.