Click here to Skip to main content
15,886,518 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 264.3K   12.7K   106  
Using MCIWnd wrapper class to write a simple media player
#if !defined(AFX_EASYPLAYER_H_INCLUDED_)
#define AFX_EASYPLAYER_H_INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// EasyPlayer.h : header file
//

#include <afxmt.h>

#pragma comment(lib, "vfw32.lib")
/////////////////////////////////////////////////////////////////////////////
// CEasyPlayer window

class CEasyPlayer : public CWnd
{
public:
	CEasyPlayer();
	CEasyPlayer(HWND hwParent);

public:
	HWND hwndParent;

public:
	long lPos;
	void Rwd();
	void Fwd();
	void DecreaseVolume();
	void IncreaseVolume();
	long GetVolume();
	long lVolume;
	void SetVolume(long lVol);
	long GetLength();
	long GetPosition();
	void SetPosition(long lPos);
	HWND GetWindowHandle();
	void Resume();
	void Kill();
	void Break();
	void Loop();
	void Close();
	HWND Initialize();
	void Play();
	void Stop();
	void Pause();
	long GetMode();
	CString GetPath();
	void SetPath(CString sPath);
	void SetParent(HWND hParent);
	HWND GetParent();
	virtual ~CEasyPlayer();

protected:
	HWND c_Player;
	CEvent m_Event;
	CString m_sPath;

	//{{AFX_MSG(CEasyPlayer)
	afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


class CParams
{
public:
	CParams() {};
	virtual ~CParams() {};

	CWnd* pWnd;
	HWND  hWnd;
	CEvent* pEvent;
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_EASYPLAYER_H_INCLUDED_)

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