Click here to Skip to main content
15,880,796 members
Articles / Desktop Programming / MFC

A Basic Media Player

Rate me:
Please Sign up or sign in to vote.
4.45/5 (40 votes)
10 Jan 2013GPL33 min read 263.7K   12.7K   106  
Using MCIWnd wrapper class to write a simple media player
// PrefDlg.cpp : implementation file
//

#include "stdafx.h"
#include "mci.h"
#include "PrefDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPrefDlg dialog


CPrefDlg::CPrefDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPrefDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPrefDlg)
	m_AutoStart = FALSE;
	m_Loop = FALSE;
	m_Rew = FALSE;
	//}}AFX_DATA_INIT
}


void CPrefDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPrefDlg)
	DDX_Check(pDX, IDC_AUTOSTART, m_AutoStart);
	DDX_Check(pDX, IDC_LOOP, m_Loop);
	DDX_Check(pDX, IDC_REW, m_Rew);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPrefDlg, CDialog)
	//{{AFX_MSG_MAP(CPrefDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPrefDlg message handlers

BOOL CPrefDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_AutoStart=rs.GetPlayAutoStart();
	m_Loop=rs.GetPlayLoop();
	m_Rew=rs.GetPlayRewind();

	UpdateData(FALSE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPrefDlg::OnOK() 
{
	UpdateData(TRUE);

	rs.SetPlayAutoStart(m_AutoStart);
	rs.SetPlayRewind(m_Rew);
	rs.SetPlayLoop(m_Loop);
	
	CDialog::OnOK();
}

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)


Written By
Chief Technology Officer
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions