// MyPlayerDlg.cpp : implementation file
// Download by http://www.codefans.net
#include "stdafx.h"
#include "MyPlayer.h"
#include "MyPlayerDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "StarWarsCtrl.h"
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
CStarWarsCtrl m_starWar;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
DDX_Control(pDX, IDC_STARWARS, m_starWar);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyPlayerDlg dialog
CMyPlayerDlg::CMyPlayerDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyPlayerDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyPlayerDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyPlayerDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyPlayerDlg)
DDX_Control(pDX, IDC_BTN_SHOWMENU, m_btnShowMenu);
DDX_Control(pDX, IDC_BTN_LYRIC, m_btnLyric);
DDX_Control(pDX, IDC_BTN_VOLUME, m_volume);
DDX_Control(pDX, IDC_BTN_SLIDE, m_slide);
DDX_Control(pDX, IDC_STATIC_MODE, m_stcMode);
DDX_Control(pDX, IDC_STATIC_PLAY, m_stcPlay);
DDX_Control(pDX, IDC_BTN_STOP, m_btnStop);
DDX_Control(pDX, IDC_BTN_PREV, m_btnPrev);
DDX_Control(pDX, IDC_BTN_PLAYLIST_SHOW, m_btnPLShow);
DDX_Control(pDX, IDC_BTN_PLAY, m_btnPlay);
DDX_Control(pDX, IDC_BTN_OPEN, m_btnOpen);
DDX_Control(pDX, IDC_BTN_NEXT, m_btnNext);
DDX_Control(pDX, IDC_BTN_MIN, m_btnMin);
DDX_Control(pDX, IDC_BTN_HIDE, m_btnHide);
DDX_Control(pDX, IDC_BTN_EXIT, m_btnExit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyPlayerDlg, CDialog)
//{{AFX_MSG_MAP(CMyPlayerDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_LBUTTONDOWN()
ON_BN_CLICKED(IDC_BTN_EXIT, OnBtnExit)
ON_WM_CREATE()
ON_WM_TIMER()
ON_BN_CLICKED(IDC_STATIC_MODE, OnStaticMode)
ON_BN_CLICKED(IDC_STATIC_PLAY, OnStaticPlay)
ON_BN_CLICKED(IDC_BTN_VOLUME, OnBtnVolume)
ON_BN_CLICKED(IDC_BTN_SLIDE, OnBtnSlide)
ON_BN_CLICKED(IDC_BTN_PLAYLIST_SHOW, OnBtnPlaylistShow)
ON_WM_MOVE()
ON_BN_CLICKED(IDC_BTN_LYRIC, OnBtnLyric)
ON_BN_CLICKED(IDC_BTN_OPEN, OnBtnOpen)
ON_BN_CLICKED(IDC_BTN_NEXT, OnBtnNext)
ON_BN_CLICKED(IDC_BTN_PLAY, OnBtnPlay)
ON_BN_CLICKED(IDC_BTN_PREV, OnBtnPrev)
ON_BN_CLICKED(IDC_BTN_STOP, OnBtnStop)
ON_WM_RBUTTONDOWN()
ON_BN_CLICKED(IDC_BTN_SHOWMENU, OnBtnShowmenu)
ON_WM_KILLFOCUS()
ON_COMMAND(IDC_MENU_NEXT, OnMenuNext)
ON_COMMAND(IDC_MENU_OPEN, OnMenuOpen)
ON_COMMAND(IDC_MENU_PLAY, OnMenuPlay)
ON_COMMAND(IDC_MENU_PREV, OnMenuPrev)
ON_COMMAND(IDC_MENU_RAND, OnMenuRand)
ON_COMMAND(IDC_MENU_SEQ, OnMenuSeq)
ON_COMMAND(IDC_MENU_SINGLE, OnMenuSingle)
ON_COMMAND(IDC_MENU_STOP, OnMenuStop)
ON_COMMAND(IDC_MENU_VOLDOWN, OnMenuVoldown)
ON_COMMAND(IDC_MENU_PAUSE, OnMenuPause)
ON_COMMAND(IDC_MENU_VOLSLC, OnMenuVolslc)
ON_COMMAND(IDC_MENU_VOLUP, OnMenuVolup)
ON_COMMAND(IDC_ABOUT_STAR, OnAboutStar)
ON_MESSAGE(MYWM_NOTIFYICON,OnNotifyIcon)
ON_BN_CLICKED(IDC_BTN_HIDE, OnBtnHide)
ON_BN_CLICKED(IDC_BTN_MIN, OnBtnMin)
ON_COMMAND(IDC_SET_LYRICPATH, OnSetLyricpath)
ON_COMMAND(IDC_MENU_OPEN_LYRICPATH, OnMenuOpenLyricpath)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyPlayerDlg message handlers
BOOL CMyPlayerDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
InitButtons();
InitRect();
InitText();
InitSize();
CreateLyric();
CreatePlayList();
m_pMenuDlg=NULL;
InitFileList();
strTitle=" 星空旋律 ";
strTime="00:00";
m_nTime=0;
fInited=TRUE;
fPlaying=FALSE;
fPlay=TRUE;
nRollTextCounter=0;
SetWindowText("星空旋律");
m_strLyricPath="";
if(ReadConfig()){
m_pPlayListDlg->OpenList(nCurrentList);
m_volume.SetPos(m_nVolume);
if(m_nPlayMode==MODE_SEQ)
OnStaticMode();
if(m_nPlayMode==MODE_SINGLE){
OnStaticMode();
OnStaticMode();
}
}else{
m_nPlayMode=MODE_RAND;
nCurrentList=0;
m_pPlayListDlg->OpenList(nCurrentList);
m_nVolume=8;
m_volume.SetPos(m_nVolume);
}
CreateNotifyIcon();
SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
m_pLyricDlg->SetPlayListWnd(m_pPlayListDlg);
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMyPlayerDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPaintDC dc(this);
DrawMainPicture(&dc);
DrawText(&dc);
DrawTime(&dc);
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMyPlayerDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CMyPlayerDlg::InitButtons()
{
CRect rect;
rect.right=1000;
rect.bottom=1000;
rect.left=224;
rect.top=42;
m_btnOpen.MoveWindow(&rect,TRUE);
m_btnOpen.Init(IDB_OPEN_NORMAL,IDB_OPEN_OVER,"打开文件");
rect.left-=18;
m_btnNext.MoveWindow(&rect,TRUE);
m_btnNext.Init(IDB_NEXT_NORMAL,IDB_NEXT_OVER,"下一首");
rect.left-=19;
m_btnPrev.MoveWindow(&rect,TRUE);
m_btnPrev.Init(IDB_PREV_NORMAL,IDB_PREV_OVER,"上一首");
rect.left-=18;
m_btnPlay.MoveWindow(&rect,TRUE);
m_btnPlay.Init(IDB_PLAY_NORMAL,IDB_PLAY_OVER,"播放");
rect.left-=20;
m_btnStop.MoveWindow(&rect,TRUE);
m_btnStop.Init(IDB_STOP_NORMAL,IDB_STOP_OVER,"停止");
rect.top=0;
rect.left=240;
m_btnHide.MoveWindow(&rect,TRUE);
m_btnHide.Init(IDB_HIDE_NORMAL,IDB_HIDE_OVER,"隐藏窗体");
rect.left+=14;
m_btnMin.MoveWindow(&rect,TRUE);
m_btnMin.Init(IDB_MIN_NORMAL,IDB_MIN_OVER,"最小化");
rect.left+=14;
m_btnExit.MoveWindow(&rect,TR
fanxbl957
- 粉丝: 2830
- 资源: 1188
最新资源
- 毕设和企业适用springboot社交应用平台类及虚拟人类交互系统源码+论文+视频.zip
- 毕设和企业适用springboot人力资源管理类及智能会议管理平台源码+论文+视频.zip
- 毕设和企业适用springboot商城类及城市智能运营平台源码+论文+视频.zip
- 毕设和企业适用springboot商城类及车联网管理平台源码+论文+视频.zip
- 毕设和企业适用springboot社交互动平台类及食品配送平台源码+论文+视频.zip
- 毕设和企业适用springboot社交互动平台类及视频监控系统源码+论文+视频.zip
- 毕设和企业适用springboot社交互动平台类及视频内容分发平台源码+论文+视频.zip
- 毕设和企业适用springboot社交应用平台类及云计算资源管理平台源码+论文+视频.zip
- 毕设和企业适用springboot社交应用平台类及用户反馈平台源码+论文+视频.zip
- 毕设和企业适用springboot社交应用平台类及用户数据分析平台源码+论文+视频.zip
- 毕设和企业适用springboot商城类及个性化推荐系统源码+论文+视频.zip
- 毕设和企业适用springboot商城类及电子产品维修平台源码+论文+视频.zip
- 毕设和企业适用springboot商城类及风险控制平台源码+论文+视频.zip
- 毕设和企业适用springboot社交互动平台类及数据存储平台源码+论文+视频.zip
- 毕设和企业适用springboot社交互动平台类及数据智能化平台源码+论文+视频.zip
- 毕设和企业适用springboot社交互动平台类及投票平台源码+论文+视频.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈