// MusicPlayerDlg.h : header file // #include "Playlist.h" #include "MusicOpenFileDlg.h" #include "Dshow.h" #include "streams.h" #include "uuids.h" #include "BmpStatic.h" #pragma comment (lib,"Ole32.lib") #pragma comment (lib,"Strmiids.lib") #pragma comment (lib,"Mmtimer.lib") #if !defined(AFX_MUSICPLAYERDLG_H__4C1232D9_A0A8_4C0B_8978_1448CE5F0467__INCLUDED_) #define AFX_MUSICPLAYERDLG_H__4C1232D9_A0A8_4C0B_8978_1448CE5F0467__INCLUDED_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #define WM_DSPLAYER (WM_USER + 100) // 绘制播放时间消息 #define WM_DRAWPLAYTIME (WM_USER + 105) // 定时器回调函数 void PlayerTimeProc(UINT uTimerID,UINT uMsg,DWORD_PTR dwUser,DWORD_PTR dw1,DWORD dw2); ///////////////////////////////////////////////////////////////////////////// // CMusicPlayerDlg dialog class CMusicPlayerDlg : public CDialog { private: CDC m_BgDC; CDC m_MemDC; CDC m_BlockDC; CDC m_BlockDCD; MMRESULT m_Timer; CFont m_txtFont; bool m_BlockD; bool m_InitDC; CString m_TitleText; CString m_SourceFile; bool m_InitGraph; // DirectShow 接口 IGraphBuilder *m_pGraph; // Graph IMediaControl *m_pMediaControl; // 播放器接口 IMediaEventEx *m_pEvent; // 事件接口 IMediaSeeking *m_pSeek; // 数据流定位接口 CPlaylist m_Playlist; bool m_RandomPlay; bool m_ReplayAll; // Construction public: void ShowPlayTime(void); CString GetFileName(CString sPath); void ShowProgress(void); void CreateGraph(void); int GetCurrentPosition(void); int GetDuration(void); HRESULT GetPlayerStatus(void); bool IsStopped(void); bool IsPaused(void); bool IsPlaying(void); void DisposeGraph(void); bool SetCurrentPosition(int iPosition); CMusicPlayerDlg(CWnd* pParent = NULL); // standard constructor ~CMusicPlayerDlg(); // Dialog Data //{{AFX_DATA(CMusicPlayerDlg) enum { IDD = IDD_MUSICPLAYER_DIALOG }; CBmpStatic m_labTime; CBmpStatic m_labFile; CBmpStatic m_labAllTime; CBitmapButton m_butStop; CBitmapButton m_butRandom; CBitmapButton m_butPre; CBitmapButton m_butOpen; CBitmapButton m_butPlay; CBitmapButton m_butNext; CBitmapButton m_butExit; CBitmapButton m_butAll; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMusicPlayerDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CMusicPlayerDlg) virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnButtonCircle(); afx_msg void OnButtonExit(); afx_msg void OnButtonNext(); afx_msg void OnButtonOpen(); afx_msg void OnButtonPlay(); afx_msg void OnButtonPre(); afx_msg void OnButtonRedom(); afx_msg void OnButtonStop(); afx_msg void OnDSPlayer(); afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnPlayerTimer(WPARAM wParam, LPARAM lParam); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MUSICPLAYERDLG_H__4C1232D9_A0A8_4C0B_8978_1448CE5F0467__INCLUDED_)