版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、第一步:打開vc6.0,建立如圖所示mfc工程文件選擇基于對(duì)話框的確定刪除所有空間,建立如圖所示對(duì)話框?qū)傩匀缦拢翰シ?IDC_open;添加 IDC_fileopen;暫停 IDC_pause;刪除 IDC_del;停止 IDC_stop;退出 IDC_exit;音樂名編輯框 IDC_filename;音量控制滑塊 IDC_SLIDER1;音量控制編輯框 IDC_vol;建立類向?qū)?duì)應(yīng)如下:在工程文件,右鍵,插入,bitmap位圖引入你想插入的背景圖,必須是bmp格式的進(jìn)入你的dlg.cpp文件在onpaint函數(shù)下添加代碼void CMp3Dlg:OnPaint() if (IsIconic
2、()CPaintDC dc(this); / device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);/ Center icon in client rectangleint cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(&rect);int x = (rect.Width() - cxIcon + 1) / 2
3、;int y = (rect.Height() - cyIcon + 1) / 2;/ Draw the icondc.DrawIcon(x, y, m_hIcon);else/CDialog:OnPaint();CPaintDC dc(this); CRect rect; GetClientRect(&rect); CDC dcMem; dcMem.CreateCompatibleDC(&dc); CBitmap bmpBackground; bmpBackground.LoadBitmap(IDB_BITMAP6); /IDB_BITMAP6是你的位圖地址BITMAP bi
4、tmap; bmpBackground.GetBitmap(&bitmap); CBitmap *pbmpOld=dcMem.SelectObject(&bmpBackground); dc.StretchBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,bitmap.bmWidth,bitmap.bmHeight,SRCCOPY); 編譯運(yùn)行,你就會(huì)看到背景有圖片了。插入-類,找到geneticclass,類名mp3.cpp你會(huì)發(fā)現(xiàn)在頭文件中多了一個(gè)mp3.h文件在mp3.h文件中添加代碼如下/ Mp3.h: interfac
5、e for the Mp3 class./#if !defined(AFX_MP3_H_20D325E5_A96A_43FE_A485_92F57C68DD0D_INCLUDED_)#define AFX_MP3_H_20D325E5_A96A_43FE_A485_92F57C68DD0D_INCLUDED_#if _MSC_VER > 1000#pragma once#endif / _MSC_VER > 1000#include "Mmsystem.h"class Mp3 public:Mp3();virtual Mp3(); HWND m_hWnd; /&
6、#188;Ǽµ±Ç°´°¿ÚµÄ¾ä±úDWORD DeviceID;/Ö¸¶¨²¥·ÅÒôÀÖµÄÉ豸ID MCI_OPEN_PARMS mciopenparms; /Ö¸¶¨´ò
7、¿ªÒôÀÖÎļþµÄ²ÎÊý void Load(HWND hwnd,CString Strfilepath);DWORD getinformation(DWORD item);void Play();void Pause();void resum();void Stop();#endif / !defined(AFX_MP3_H_20D325E5_A96A_43FE_A485_92F57C68DD0D_INCLUDED_)在mp3
8、.cpp中添加如下代碼/ Mp3.cpp: implementation of the Mp3 class./#include "stdafx.h"#include "Mp3²¥·ÅÆ÷.h"#include "Mp3.h"#ifdef _DEBUG#undef THIS_FILEstatic char THIS_FILE=_FILE_;#define new DEBUG_NEW#endif/ Construction/Destruction/Mp3:Mp3()Mp3:Mp3
9、()void Mp3:Load(HWND hwnd,CString Strfilepath)m_hWnd=hwnd;mciSendCommand(DeviceID,MCI_CLOSE,0,0); /¼ÓÔØÎļþÇ°ÏÈÇå³ýÉÏ´ÎÉèÖÃmciopenparms.lpstrElementName=Strfilepath;/½«
10、210;ôÀÖÎļþ·¾¶´«¸øÉ豸DWORD dwReturn;if (dwReturn=mciSendCommand(NULL,MCI_OPEN,MCI_OPEN_ELEMENT|MCI_WAIT,(DWORD)(LPVOID)&mciopenparms)/Èç¹û´ò¿ªÊ§°
11、;Ü£¬½«³ö´íÐÅÏ¢´æÔÚbuffer²¢ÏÔʾ³ö´í¾¯¸æchar buffer256; mciGetErrorString(dwReturn,buffer,256);MessageBox(hwnd,buffer,"³ö´í
12、;¾¯¸æ",MB_ICONHAND|MB_ICONERROR|MB_ICONSTOP);DeviceID=mciopenparms.wDeviceID; /¶àýÌåÉ豸ÀàÐͱàºÅDWORD Mp3:getinformation(DWORD item)/MCI½Ó¿Ú¶ÔÏó
13、µÄ״̬MCI_STATUS_PARMS mcistatusparms;/´ý»ñÈ¡µÄÏîÄ¿mcistatusparms.dwItem=item;mcistatusparms.dwReturn=0;/Ïë¶àýÌåÉ豸·¢ËÍÖ
14、84;Á»ñÈ¡µ±Ç°µÄ״̬²ÎÊýmciSendCommand(DeviceID,MCI_STATUS,MCI_STATUS_ITEM,(DWORD)&mcistatusparms);return mcistatusparms.dwReturn; void Mp3:Play()MCI_PLAY_PARMS mciplayparms;mciplayparm
15、s.dwCallback=(DWORD)m_hWnd;mciplayparms.dwFrom=0; /ÿ´Î´ÓÍ·²¥·ÅmciSendCommand(DeviceID,MCI_PLAY,MCI_FROM|MCI_NOTIFY,(DWORD)(LPVOID)&mciplayparms);void Mp3:Pause()mciSendCommand(DeviceID,MCI_PAUSE,0,0);void Mp3:resum()mciSendCommand(Devi
16、ceID,MCI_RESUME,0,0);void Mp3:Stop()mciSendCommand(DeviceID,MCI_STOP,0,0);mciSendCommand(DeviceID,MCI_CLOSE,0,0);在dlg.cpp文件的public中添加一行代碼:int hour,minute,second;在CMp3Dlg:CMp3Dlg(CWnd* pParent /*=NULL*/)中添加如下CMp3Dlg:CMp3Dlg(CWnd* pParent /*=NULL*/): CDialog(CMp3Dlg:IDD, pParent)/AFX_DATA_INIT(CMp3Dlg
17、)m_int = 0;/AFX_DATA_INIT/ Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon = AfxGetApp()->LoadIcon(IDI_ICON1);hour=0;minute=0;second=0;dlg.cpp中頭文件如下:#include "stdafx.h"#include "Mp3²¥·ÅÆ÷.h"#include "Mp3²
18、5;·ÅÆ÷Dlg.h"#include "Mmsystem.h"#include "Digitalv.h" #include "Mp3.h" /ÒôÁ¿¿ØÖÆÓõ½#pragma comment(lib,"Winmm.lib")#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic c
19、har THIS_FILE = _FILE_;#endif在對(duì)話框中雙擊添加添加onfileopen函數(shù),代碼如下void CMp3Dlg:Onfileopen() char filefiler="mp3文件(*.mp3)|*.mp3|" "wma文件(*.wma)|*.wma|" "wav文件(*.wav)|*.wav|"CFileDialog dlg(true,NULL,NULL,OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLESIZING,filefiler);if (dlg.Do
20、Modal()=IDOK)CString strfilepath=dlg.GetPathName();CString strfilename=dlg.GetFileName();SetDlgItemText(IDC_filename,strfilename);CString mtime;CClientDC dc(this);hour=0;minute=0;second=0;dc.SetBkColor(RGB(124,252,0);/設(shè)置放置計(jì)數(shù)器區(qū)域的外觀dc.SetTextColor(RGB(255,255,203);/設(shè)置數(shù)字顯示的顏色mtime.Format("%02d:%02
21、d:%02d",hour,minute,second);/顯示時(shí)間進(jìn)度dc.TextOut(280,128,mtime);Mp3 mp3;mp3.Load(this->m_hWnd,strfilepath);GetDlgItem(IDC_open)->EnableWindow(TRUE);GetDlgItem(IDC_pause)->EnableWindow(TRUE);GetDlgItem(IDC_stop)->EnableWindow(TRUE);GetDlgItem(IDC_del)->EnableWindow(TRUE); m_list.Inse
22、rtString(m_list.GetCount(),strfilename);/獲取文件名 m_list.SetCurSel(m_list.GetCount()-1);雙擊播放,進(jìn)入代碼,添加如下void CMp3Dlg:Onopen() CString strfilename;int index=m_list.GetCurSel();CString mtime;CClientDC dc(this);Mp3 mp3;hour=0;minute=0;second=0;dc.SetBkColor(RGB(124,252,0);/設(shè)置放置計(jì)數(shù)器區(qū)域的外觀dc.SetTextColor(RGB(25
23、5,255,203);/設(shè)置數(shù)字顯示的顏色mtime.Format("%02d:%02d:%02d",hour,minute,second);/顯示時(shí)間進(jìn)度dc.TextOut(280,128,mtime);if(index=-1)MessageBox("請(qǐng)?zhí)砑右魳?quot;);return;m_list.GetText(index,strfilename);SetDlgItemText(IDC_filename,strfilename); mp3.Stop();mp3.Load(this->m_hWnd,strfilename);mp3.Play();
24、SetTimer(0,1000,NULL);同理,暫停,停止,刪除,退出代碼如下void CMp3Dlg:Onpause() / TODO: Add your control notification handler code hereCString strtemp;Mp3 mp3;GetDlgItemText(IDC_pause,strtemp);/獲取按鈕狀態(tài)if (strtemp.Compare("暫停")=0)mp3.Pause();SetDlgItemText(IDC_pause,"繼續(xù)");KillTimer(0);/取消計(jì)數(shù)器的顯示if (
25、strtemp.Compare("繼續(xù)")=0)mp3.resum();SetTimer(0,1000,NULL);SetDlgItemText(IDC_pause,"暫停");void CMp3Dlg:Onstop() / TODO: Add your control notification handler code hereMp3 mp3;mp3.Stop();SetDlgItemText(IDC_pause,"暫停");KillTimer(0);/取消計(jì)數(shù)器的顯示CString mtime;CClientDC dc(this)
26、;hour=0;minute=0;second=0;dc.SetBkColor(RGB(124,252,0);/設(shè)置放置計(jì)數(shù)器區(qū)域的外觀dc.SetTextColor(RGB(255,255,203);/設(shè)置數(shù)字顯示的顏色mtime.Format("%02d:%02d:%02d",hour,minute,second);/顯示時(shí)間進(jìn)度dc.TextOut(280,128,mtime);GetDlgItem(IDC_open)->EnableWindow(FALSE);GetDlgItem(IDC_pause)->EnableWindow(FALSE);GetDl
27、gItem(IDC_stop)->EnableWindow(FALSE); GetDlgItem(IDC_del)->EnableWindow(FALSE);void CMp3Dlg:Ondel() UpdateData(TRUE);Mp3 mp3;int index=m_list.GetCurSel();mp3.Stop();SetDlgItemText(IDC_filename,"");KillTimer(0);hour=0;minute=0;second=0;/歌曲時(shí)間置0if (index!=CB_ERR)m_list.DeleteString(inde
28、x);void CMp3Dlg:Onexit() / TODO: Add your control notification handler code hereCDialog:OnCancel();ctrl+w打開類向?qū)?,如圖,添加ontimer函數(shù)代碼如下:void CMp3Dlg:OnTimer(UINT nIDEvent) / TODO: Add your message handler code here and/or call defaultCString mtime;Mp3 mp3;second+;CClientDC dc(this);dc.SetBkColor(RGB(124,2
29、52,0);/設(shè)置放置計(jì)數(shù)器區(qū)域的外觀dc.SetTextColor(RGB(255,255,203);/設(shè)置數(shù)字顯示的顏色 if(second=60)/設(shè)置鐘表的顯示minute+;second=0;if(minute=60)hour+;minute=0;mtime.Format("%02d:%02d:%02d",hour,minute,second);/顯示時(shí)間進(jìn)度dc.TextOut(280,128,mtime); DWORD cdf=mp3.getinformation(MCI_STATUS_POSITION);DWORD cdfrom; cdfrom=MCI_MA
30、KE_MSF(MCI_MSF_MINUTE(cdf),MCI_MSF_SECOND(cdf),MCI_MSF_FRAME(cdf);/獲取當(dāng)前播放文件的信息UpdateData(false);CDialog:OnTimer(nIDEvent);ctrl+w打開類向?qū)砑雍瘮?shù)如下void CMp3Dlg:OnDblclkList() /在列表中選中,雙擊左鍵播放音樂CString mtime;Mp3 mp3;CClientDC dc(this);hour=0;minute=0;second=0;dc.SetBkColor(RGB(124,252,0);/設(shè)置放置計(jì)數(shù)器區(qū)域的外觀dc.SetTex
31、tColor(RGB(255,255,203);/設(shè)置數(shù)字顯示的顏色mtime.Format("%02d:%02d:%02d",hour,minute,second);/顯示時(shí)間進(jìn)度dc.TextOut(280,128,mtime);CString strfilename;int index=m_list.GetCurSel();m_list.GetText(index,strfilename);SetDlgItemText(IDC_filename,strfilename);mp3.Stop();mp3.Load(this->m_hWnd,strfilename);
32、mp3.Play(); SetTimer(0,1000,NULL);打開類向?qū)?,添加函?shù)如下void CMp3Dlg:OnCustomdrawSlider1(NMHDR* pNMHDR, LRESULT* pResult) / TODO: Add your control notification handler code hereUpdateData(true);m_int=m_slider.GetPos()/10;Setvolumn(m_slider.GetPos();UpdateData(false);*pResult = 0;打開類向?qū)?,添加函?shù)如下void CMp3Dlg:OnRel
33、easedcaptureSlider1(NMHDR* pNMHDR, LRESULT* pResult) / TODO: Add your control notification handler code hereSetvolumn(m_slider.GetPos();*pResult = 0;添加聲音設(shè)置函數(shù)如下DWORD CMp3Dlg:Setvolumn(DWORD vol)MCI_DGV_SETAUDIO_PARMS mcisetvolumn;mcisetvolumn.dwCallback=NULL;mcisetvolumn.dwItem=MCI_DGV_SETAUDIO_VOLUM
34、E;mcisetvolumn.dwValue=vol; MCI_OPEN_PARMS mciopenparms;DWORD DeviceID;DeviceID=mciopenparms.wDeviceID;mciSendCommand(DeviceID,MCI_SETAUDIO,MCI_DGV_SETAUDIO_VALUE|MCI_DGV_SETAUDIO_ITEM,(DWORD)(LPVOID)&mcisetvolumn);/return mcisetvolumn.dwValue;return 0;到此已經(jīng)基本完成了,我們可以試聽一下接下來我們可以到包成exe可執(zhí)行文件,為了去掉那個(gè)
35、不好看的圖標(biāo),我們可以進(jìn)入res文件夾,把原來的圖標(biāo)刪掉,不過,你要放入一個(gè)cio格式的圖片作為圖標(biāo),cio格式網(wǎng)上有很多轉(zhuǎn)換的,刪掉原圖標(biāo)后,程序會(huì)自動(dòng)生成一個(gè)你放進(jìn)去的圖標(biāo)。接下來演示打包:工程,設(shè)置,或者按alt+f7,如圖設(shè)置組建,批組建,如圖創(chuàng)建完成后,你就會(huì)發(fā)現(xiàn)在你的工程文件中多了一個(gè)release文件夾,打開找到exe,這個(gè)文件就是打包好的,隨便放到哪里都可以執(zhí)行,至此,工作基本完成了,最后附上源代碼,僅供參考dlg.cpp文件/ Mp3播放器Dlg.cpp : implementation file/#include "stdafx.h"#include &
36、quot;Mp3播放器.h"#include "Mp3播放器Dlg.h"#include "Mmsystem.h"#include "Digitalv.h" #include "Mp3.h" /音量控制用到#pragma comment(lib,"Winmm.lib")#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CAboutDlg dialog used
37、 for App Aboutclass CAboutDlg : public CDialogpublic:CAboutDlg();/ Dialog Data/AFX_DATA(CAboutDlg)enum IDD = IDD_ABOUTBOX ;/AFX_DATA/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CAboutDlg)protected:virtual void DoDataExchange(CDataExchange* pDX); / DDX/DDV support/AFX_VIRTUAL/ Imple
38、mentationprotected:/AFX_MSG(CAboutDlg)/AFX_MSGDECLARE_MESSAGE_MAP();CAboutDlg:CAboutDlg() : CDialog(CAboutDlg:IDD)/AFX_DATA_INIT(CAboutDlg)/AFX_DATA_INITvoid CAboutDlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CAboutDlg)/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CAboutDlg, CDia
39、log)/AFX_MSG_MAP(CAboutDlg)/ No message handlers/AFX_MSG_MAPEND_MESSAGE_MAP()/ CMp3Dlg dialogCMp3Dlg:CMp3Dlg(CWnd* pParent /*=NULL*/): CDialog(CMp3Dlg:IDD, pParent)/AFX_DATA_INIT(CMp3Dlg)m_int = 0;/AFX_DATA_INIT/ Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon = AfxGetAp
40、p()->LoadIcon(IDI_ICON1);hour=0;minute=0;second=0;void CMp3Dlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CMp3Dlg)DDX_Control(pDX, IDC_LIST, m_list);DDX_Control(pDX, IDC_SLIDER1, m_slider);DDX_Text(pDX, IDC_vol, m_int);/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CMp3Dlg, CDial
41、og)/AFX_MSG_MAP(CMp3Dlg)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(ID_exit, Onexit)ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER1, OnCustomdrawSlider1)ON_BN_CLICKED(IDC_fileopen, Onfileopen)ON_BN_CLICKED(IDC_open, Onopen)ON_BN_CLICKED(IDC_pause, Onpause)ON_BN_CLICKED(IDC_stop, Onstop)ON
42、_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER1, OnReleasedcaptureSlider1)ON_WM_TIMER()ON_BN_CLICKED(IDC_del, Ondel)ON_LBN_DBLCLK(IDC_LIST, OnDblclkList)/AFX_MSG_MAPEND_MESSAGE_MAP()/ CMp3Dlg message handlersBOOL CMp3Dlg:OnInitDialog()CDialog:OnInitDialog();/ Add "About." menu item to system menu.
43、/ 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->AppendM
44、enu(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 dialogSetIcon(m_hIcon, TRUE);/ Set big iconSetIcon(m_hIcon, FALSE); / Set small iconSetWindowText(&q
45、uot;MP3播放器");MoveWindow(250,150,580,500); /顯示時(shí)間控制m_slider.SetRange(0,1000); /移動(dòng)范圍m_slider.SetPos(500);/滑塊指針的初始位置GetDlgItem(IDC_open)->EnableWindow(FALSE);GetDlgItem(IDC_pause)->EnableWindow(FALSE);GetDlgItem(IDC_stop)->EnableWindow(FALSE); GetDlgItem(IDC_del)->EnableWindow(FALSE);/
46、TODO: Add extra initialization herereturn TRUE; / return TRUE unless you set the focus to a controlvoid CMp3Dlg:OnSysCommand(UINT nID, LPARAM lParam)if (nID & 0xFFF0) = IDM_ABOUTBOX)CAboutDlg dlgAbout;dlgAbout.DoModal();elseCDialog:OnSysCommand(nID, lParam);/ If you add a minimize button to your
47、 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 CMp3Dlg:OnPaint() if (IsIconic()CPaintDC dc(this); / device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc
48、(), 0);/ Center icon in client rectangleint 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 icondc.DrawIcon(x, y, m_hIcon);else/CDialog:OnPain
49、t();CPaintDC dc(this); CRect rect; GetClientRect(&rect); CDC dcMem; dcMem.CreateCompatibleDC(&dc); CBitmap bmpBackground; bmpBackground.LoadBitmap(IDB_BITMAP6); BITMAP bitmap; bmpBackground.GetBitmap(&bitmap); CBitmap *pbmpOld=dcMem.SelectObject(&bmpBackground); dc.StretchBlt(0,0,rec
50、t.Width(),rect.Height(),&dcMem,0,0,bitmap.bmWidth,bitmap.bmHeight,SRCCOPY); / The system calls this to obtain the cursor to display while the user drags/ the minimized window.HCURSOR CMp3Dlg:OnQueryDragIcon()return (HCURSOR) m_hIcon;void CMp3Dlg:Onexit() / TODO: Add your control notification han
51、dler code hereCDialog:OnCancel();void CMp3Dlg:OnCustomdrawSlider1(NMHDR* pNMHDR, LRESULT* pResult) / TODO: Add your control notification handler code hereUpdateData(true);m_int=m_slider.GetPos()/10;Setvolumn(m_slider.GetPos();UpdateData(false);*pResult = 0;void CMp3Dlg:Onfileopen() char filefiler=&q
52、uot;mp3文件(*.mp3)|*.mp3|" "wma文件(*.wma)|*.wma|" "wav文件(*.wav)|*.wav|"CFileDialog dlg(true,NULL,NULL,OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLESIZING,filefiler);if (dlg.DoModal()=IDOK)CString strfilepath=dlg.GetPathName();CString strfilename=dlg.GetFileName();SetDlgItemT
53、ext(IDC_filename,strfilename);CString mtime;CClientDC dc(this);hour=0;minute=0;second=0;dc.SetBkColor(RGB(124,252,0);/設(shè)置放置計(jì)數(shù)器區(qū)域的外觀dc.SetTextColor(RGB(255,255,203);/設(shè)置數(shù)字顯示的顏色mtime.Format("%02d:%02d:%02d",hour,minute,second);/顯示時(shí)間進(jìn)度dc.TextOut(280,128,mtime);Mp3 mp3;mp3.Load(this->m_hWnd,s
54、trfilepath);GetDlgItem(IDC_open)->EnableWindow(TRUE);GetDlgItem(IDC_pause)->EnableWindow(TRUE);GetDlgItem(IDC_stop)->EnableWindow(TRUE);GetDlgItem(IDC_del)->EnableWindow(TRUE); m_list.InsertString(m_list.GetCount(),strfilename);/獲取文件名 m_list.SetCurSel(m_list.GetCount()-1);void CMp3Dlg:On
55、open() CString strfilename;int index=m_list.GetCurSel();CString mtime;CClientDC dc(this);Mp3 mp3;hour=0;minute=0;second=0;dc.SetBkColor(RGB(124,252,0);/設(shè)置放置計(jì)數(shù)器區(qū)域的外觀dc.SetTextColor(RGB(255,255,203);/設(shè)置數(shù)字顯示的顏色mtime.Format("%02d:%02d:%02d",hour,minute,second);/顯示時(shí)間進(jìn)度dc.TextOut(280,128,mtime);
56、if(index=-1)MessageBox("請(qǐng)?zhí)砑右魳?quot;);return;m_list.GetText(index,strfilename);SetDlgItemText(IDC_filename,strfilename); mp3.Stop();mp3.Load(this->m_hWnd,strfilename);mp3.Play(); SetTimer(0,1000,NULL);void CMp3Dlg:Onpause() / TODO: Add your control notification handler code hereCString strtemp;Mp3 mp3;GetDlgItemText(IDC_pause,strtemp);/獲取按鈕狀態(tài)if (strtemp.Compare("暫停")=0)mp3.Pause();SetDlgItemText(IDC_pause,"繼續(xù)");Kill
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年反腐倡廉警示教育工作總結(jié)
- 美術(shù)鑒賞與創(chuàng)新思維
- 2006年貴州高考語(yǔ)文真題及答案
- 體育用品行政后勤工作總結(jié)
- 體育用品行業(yè)行政后勤工作總結(jié)
- 2023-2024年員工三級(jí)安全培訓(xùn)考試題附答案【完整版】
- 2024企業(yè)主要負(fù)責(zé)人安全培訓(xùn)考試題及答案(名校卷)
- 教師期末教學(xué)工作總結(jié)4篇
- 快樂的國(guó)慶節(jié)作文400字5篇
- 市場(chǎng)震動(dòng)月度報(bào)告
- 工程機(jī)械租賃服務(wù)方案及保障措施 (1)
- 功率因數(shù)調(diào)整電費(fèi)辦法
- 美發(fā)基礎(chǔ)(課堂PPT)
- WordA4信紙(A4橫條直接打印版)
- 藥品庫(kù)存清單(2015年)
- (完整版)會(huì)計(jì)準(zhǔn)則(全文)
- 百家姓全文拼音版A4打印
- 專家論證挖孔樁專項(xiàng)施工方案
- IPC標(biāo)準(zhǔn)解析學(xué)習(xí)課程
- 麻花鉆鉆孔中常見問題的原因和解決辦法
- 部分常用巖土經(jīng)驗(yàn)值
評(píng)論
0/150
提交評(píng)論