Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

A Basic Media Player

, 10 Jan 2013 GPL3
Using MCIWnd wrapper class to write a simple media player
// DlgProxy.cpp : implementation file
//

#include "stdafx.h"
#include "mci.h"
#include "DlgProxy.h"
#include "mciDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CmciDlgAutoProxy

IMPLEMENT_DYNCREATE(CmciDlgAutoProxy, CCmdTarget)

CmciDlgAutoProxy::CmciDlgAutoProxy()
{
	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 (AfxGetApp()->m_pMainWnd != NULL);
	ASSERT_VALID (AfxGetApp()->m_pMainWnd);
	ASSERT_KINDOF(CmciDlg, AfxGetApp()->m_pMainWnd);
//	m_pDialog = (CmciDlg*) AfxGetApp()->m_pMainWnd;
//	m_pDialog->m_pAutoProxy = this;
}

CmciDlgAutoProxy::~CmciDlgAutoProxy()
{
	// 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 CmciDlgAutoProxy::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.

	CCmdTarget::OnFinalRelease();
}

BEGIN_MESSAGE_MAP(CmciDlgAutoProxy, CCmdTarget)
	//{{AFX_MSG_MAP(CmciDlgAutoProxy)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CmciDlgAutoProxy, CCmdTarget)
	//{{AFX_DISPATCH_MAP(CmciDlgAutoProxy)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_Imci to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {D0E7DC99-C5E5-4B10-9F23-525A0C3600B0}
static const IID IID_Imci =
{ 0xd0e7dc99, 0xc5e5, 0x4b10, { 0x9f, 0x23, 0x52, 0x5a, 0xc, 0x36, 0x0, 0xb0 } };

BEGIN_INTERFACE_MAP(CmciDlgAutoProxy, CCmdTarget)
	INTERFACE_PART(CmciDlgAutoProxy, IID_Imci, Dispatch)
END_INTERFACE_MAP()

// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
// {79A174D3-F838-49A9-AF52-5324236E6A27}
IMPLEMENT_OLECREATE2(CmciDlgAutoProxy, "mci.Application", 0x79a174d3, 0xf838, 0x49a9, 0xaf, 0x52, 0x53, 0x24, 0x23, 0x6e, 0x6a, 0x27)

/////////////////////////////////////////////////////////////////////////////
// CmciDlgAutoProxy message handlers

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

M. Bonvari
Other
Iran (Islamic Republic Of) Iran (Islamic Republic Of)
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411028.1 | Last Updated 10 Jan 2013
Article Copyright 2003 by M. Bonvari
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid