欢迎来到天天文库
浏览记录
ID:8972216
大小:57.00 KB
页数:10页
时间:2018-04-13
《win32api开发的音乐播放器》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、win32API开发的音乐播放器vs2010编译成功 //stdAfx.h#ifndef VOL_UNIT #define VOL_UNIT 10; #endif #include //定时器 void CALLBACK getPosition(HWND hwnd,UINT uMessage,UINT iTimerID,DWORD dwTime); //播放音乐 void PlayMusic(HWND hwnd); //播放下一首歌曲 void PlayNextMusi
2、c(HWND hwnd); //停止播放 void StopMusic(HWND hwnd); //打开音乐文件 void OpenMusicFile(HWND hwnd); //resource.h// #define IDD_MAIN 101 #define IDC_BTNPLAY 1004 #define IDC_BTNSTOP 1005 #define IDC_LIS
3、TMSC 1006 #define IDC_SLIDER1 1007 #define IDC_BTNOPEN 1008 #define IDC_MONTHCALENDAR1 1014 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY
4、_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1015 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif //MainDlg.h#ifndef_MAIN_H#define_MAIN_H#include5、>BOOLWINAPIMain_Proc(HWNDhWnd,UINTuMsg,WPARAMwParam,LPARAMlParam);BOOLMain_OnInitDialog(HWNDhwnd,HWNDhwndFocus,LPARAMlParam);voidMain_OnCommand(HWNDhwnd,intid,HWNDhwndCtl,UINTcodeNotify);voidMain_OnClose(HWNDhwnd);#endif//MainDlg.cpp#include"stdafx.h"#include6、s.h>#include#include"resource.h"#include"MainDlg.h"#includeTCHARCUR_MUSIC[MAX_PATH]="";//定义全局变量记录当前播放文件的短路径intvol=1000;//记录当前的音量intindex=0;//记录当前播放文件的下标值intvolume=1000;//记录声音大小#pragmacomment(lib,"winmm.lib")BOOLWINAPIMain_Proc(HWNDhWnd,UINTuM7、sg,WPARAMwParam,LPARAMlParam){ switch(uMsg) { HANDLE_MSG(hWnd,WM_INITDIALOG,Main_OnInitDialog); HANDLE_MSG(hWnd,WM_COMMAND,Main_OnCommand);HANDLE_MSG(hWnd,WM_CLOSE,Main_OnClose);caseWM_HSCROLL:{HWNDhTrackbar=GetDlgItem(hWnd,IDC_SLIDER1);if(hTrackbar==(HWND)l8、Param){intnewPos=SendMessage(hTrackbar,TBM_GETPOS,0,0);intselStart=SendMessage(hTrackbar,TBM_GETSELSTART,0,0);intselEnd=SendMessage(hTrack
5、>BOOLWINAPIMain_Proc(HWNDhWnd,UINTuMsg,WPARAMwParam,LPARAMlParam);BOOLMain_OnInitDialog(HWNDhwnd,HWNDhwndFocus,LPARAMlParam);voidMain_OnCommand(HWNDhwnd,intid,HWNDhwndCtl,UINTcodeNotify);voidMain_OnClose(HWNDhwnd);#endif//MainDlg.cpp#include"stdafx.h"#include6、s.h>#include#include"resource.h"#include"MainDlg.h"#includeTCHARCUR_MUSIC[MAX_PATH]="";//定义全局变量记录当前播放文件的短路径intvol=1000;//记录当前的音量intindex=0;//记录当前播放文件的下标值intvolume=1000;//记录声音大小#pragmacomment(lib,"winmm.lib")BOOLWINAPIMain_Proc(HWNDhWnd,UINTuM7、sg,WPARAMwParam,LPARAMlParam){ switch(uMsg) { HANDLE_MSG(hWnd,WM_INITDIALOG,Main_OnInitDialog); HANDLE_MSG(hWnd,WM_COMMAND,Main_OnCommand);HANDLE_MSG(hWnd,WM_CLOSE,Main_OnClose);caseWM_HSCROLL:{HWNDhTrackbar=GetDlgItem(hWnd,IDC_SLIDER1);if(hTrackbar==(HWND)l8、Param){intnewPos=SendMessage(hTrackbar,TBM_GETPOS,0,0);intselStart=SendMessage(hTrackbar,TBM_GETSELSTART,0,0);intselEnd=SendMessage(hTrack
6、s.h>#include#include"resource.h"#include"MainDlg.h"#includeTCHARCUR_MUSIC[MAX_PATH]="";//定义全局变量记录当前播放文件的短路径intvol=1000;//记录当前的音量intindex=0;//记录当前播放文件的下标值intvolume=1000;//记录声音大小#pragmacomment(lib,"winmm.lib")BOOLWINAPIMain_Proc(HWNDhWnd,UINTuM
7、sg,WPARAMwParam,LPARAMlParam){ switch(uMsg) { HANDLE_MSG(hWnd,WM_INITDIALOG,Main_OnInitDialog); HANDLE_MSG(hWnd,WM_COMMAND,Main_OnCommand);HANDLE_MSG(hWnd,WM_CLOSE,Main_OnClose);caseWM_HSCROLL:{HWNDhTrackbar=GetDlgItem(hWnd,IDC_SLIDER1);if(hTrackbar==(HWND)l
8、Param){intnewPos=SendMessage(hTrackbar,TBM_GETPOS,0,0);intselStart=SendMessage(hTrackbar,TBM_GETSELSTART,0,0);intselEnd=SendMessage(hTrack
此文档下载收益归作者所有