DlgProxy.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // DlgProxy.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "Babylon.h"
  22. #include "DlgProxy.h"
  23. #include "BabylonDlg.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CBabylonDlgAutoProxy
  31. IMPLEMENT_DYNCREATE(CBabylonDlgAutoProxy, CCmdTarget)
  32. CBabylonDlgAutoProxy::CBabylonDlgAutoProxy()
  33. {
  34. EnableAutomation();
  35. // To keep the application running as long as an automation
  36. // object is active, the constructor calls AfxOleLockApp.
  37. AfxOleLockApp();
  38. // Get access to the dialog through the application's
  39. // main window pointer. Set the proxy's internal pointer
  40. // to point to the dialog, and set the dialog's back pointer to
  41. // this proxy.
  42. ASSERT (AfxGetApp()->m_pMainWnd != NULL);
  43. ASSERT_VALID (AfxGetApp()->m_pMainWnd);
  44. ASSERT_KINDOF(CBabylonDlg, AfxGetApp()->m_pMainWnd);
  45. m_pDialog = (CBabylonDlg*) AfxGetApp()->m_pMainWnd;
  46. m_pDialog->m_pAutoProxy = this;
  47. }
  48. CBabylonDlgAutoProxy::~CBabylonDlgAutoProxy()
  49. {
  50. // To terminate the application when all objects created with
  51. // with automation, the destructor calls AfxOleUnlockApp.
  52. // Among other things, this will destroy the main dialog
  53. if (m_pDialog != NULL)
  54. m_pDialog->m_pAutoProxy = NULL;
  55. AfxOleUnlockApp();
  56. }
  57. void CBabylonDlgAutoProxy::OnFinalRelease()
  58. {
  59. // When the last reference for an automation object is released
  60. // OnFinalRelease is called. The base class will automatically
  61. // deletes the object. Add additional cleanup required for your
  62. // object before calling the base class.
  63. CCmdTarget::OnFinalRelease();
  64. }
  65. BEGIN_MESSAGE_MAP(CBabylonDlgAutoProxy, CCmdTarget)
  66. //{{AFX_MSG_MAP(CBabylonDlgAutoProxy)
  67. // NOTE - the ClassWizard will add and remove mapping macros here.
  68. //}}AFX_MSG_MAP
  69. END_MESSAGE_MAP()
  70. BEGIN_DISPATCH_MAP(CBabylonDlgAutoProxy, CCmdTarget)
  71. //{{AFX_DISPATCH_MAP(CBabylonDlgAutoProxy)
  72. // NOTE - the ClassWizard will add and remove mapping macros here.
  73. //}}AFX_DISPATCH_MAP
  74. END_DISPATCH_MAP()
  75. // Note: we add support for IID_IBabylon to support typesafe binding
  76. // from VBA. This IID must match the GUID that is attached to the
  77. // dispinterface in the .ODL file.
  78. // {2BF31248-3BA1-11D3-B9DA-006097B90D93}
  79. static const IID IID_IBabylon =
  80. { 0x2bf31248, 0x3ba1, 0x11d3, { 0xb9, 0xda, 0x0, 0x60, 0x97, 0xb9, 0xd, 0x93 } };
  81. BEGIN_INTERFACE_MAP(CBabylonDlgAutoProxy, CCmdTarget)
  82. INTERFACE_PART(CBabylonDlgAutoProxy, IID_IBabylon, Dispatch)
  83. END_INTERFACE_MAP()
  84. // The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
  85. // {2BF31246-3BA1-11D3-B9DA-006097B90D93}
  86. IMPLEMENT_OLECREATE2(CBabylonDlgAutoProxy, "Babylon.Application", 0x2bf31246, 0x3ba1, 0x11d3, 0xb9, 0xda, 0x0, 0x60, 0x97, 0xb9, 0xd, 0x93)
  87. /////////////////////////////////////////////////////////////////////////////
  88. // CBabylonDlgAutoProxy message handlers