DlgProxy.cpp
上传用户:chjulong
上传日期:2020-01-10
资源大小:3427k
文件大小:3k
源码类别:

midi

开发平台:

Visual C++

  1. // DlgProxy.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "player.h"
  5. #include "DlgProxy.h"
  6. #include "playerDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CPlayerDlgAutoProxy
  14. IMPLEMENT_DYNCREATE(CPlayerDlgAutoProxy, CCmdTarget)
  15. CPlayerDlgAutoProxy::CPlayerDlgAutoProxy()
  16. {
  17. EnableAutomation();
  18. // To keep the application running as long as an automation 
  19. // object is active, the constructor calls AfxOleLockApp.
  20. AfxOleLockApp();
  21. // Get access to the dialog through the application's
  22. //  main window pointer.  Set the proxy's internal pointer
  23. //  to point to the dialog, and set the dialog's back pointer to
  24. //  this proxy.
  25. ASSERT (AfxGetApp()->m_pMainWnd != NULL);
  26. ASSERT_VALID (AfxGetApp()->m_pMainWnd);
  27. ASSERT_KINDOF(CPlayerDlg, AfxGetApp()->m_pMainWnd);
  28. m_pDialog = (CPlayerDlg*) AfxGetApp()->m_pMainWnd;
  29. m_pDialog->m_pAutoProxy = this;
  30. }
  31. CPlayerDlgAutoProxy::~CPlayerDlgAutoProxy()
  32. {
  33. // To terminate the application when all objects created with
  34. //  with automation, the destructor calls AfxOleUnlockApp.
  35. //  Among other things, this will destroy the main dialog
  36. if (m_pDialog != NULL)
  37. m_pDialog->m_pAutoProxy = NULL;
  38. AfxOleUnlockApp();
  39. }
  40. void CPlayerDlgAutoProxy::OnFinalRelease()
  41. {
  42. // When the last reference for an automation object is released
  43. // OnFinalRelease is called.  The base class will automatically
  44. // deletes the object.  Add additional cleanup required for your
  45. // object before calling the base class.
  46. CCmdTarget::OnFinalRelease();
  47. }
  48. BEGIN_MESSAGE_MAP(CPlayerDlgAutoProxy, CCmdTarget)
  49. //{{AFX_MSG_MAP(CPlayerDlgAutoProxy)
  50. // NOTE - the ClassWizard will add and remove mapping macros here.
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. BEGIN_DISPATCH_MAP(CPlayerDlgAutoProxy, CCmdTarget)
  54. //{{AFX_DISPATCH_MAP(CPlayerDlgAutoProxy)
  55. // NOTE - the ClassWizard will add and remove mapping macros here.
  56. //}}AFX_DISPATCH_MAP
  57. END_DISPATCH_MAP()
  58. // Note: we add support for IID_IPlayer to support typesafe binding
  59. //  from VBA.  This IID must match the GUID that is attached to the 
  60. //  dispinterface in the .ODL file.
  61. // {F5B21A85-5EE9-11D7-BCB5-CEB29E77AC3D}
  62. static const IID IID_IPlayer =
  63. { 0xf5b21a85, 0x5ee9, 0x11d7, { 0xbc, 0xb5, 0xce, 0xb2, 0x9e, 0x77, 0xac, 0x3d } };
  64. BEGIN_INTERFACE_MAP(CPlayerDlgAutoProxy, CCmdTarget)
  65. INTERFACE_PART(CPlayerDlgAutoProxy, IID_IPlayer, Dispatch)
  66. END_INTERFACE_MAP()
  67. // The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
  68. // {F5B21A83-5EE9-11D7-BCB5-CEB29E77AC3D}
  69. IMPLEMENT_OLECREATE2(CPlayerDlgAutoProxy, "Player.Application", 0xf5b21a83, 0x5ee9, 0x11d7, 0xbc, 0xb5, 0xce, 0xb2, 0x9e, 0x77, 0xac, 0x3d)
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CPlayerDlgAutoProxy message handlers