非常非常简单 C语言写的歌音乐播放器
没事干,纯属写着玩的,非常非常简单,要输入歌曲链接才能听,至于为什么没有浏览按钮,就当给大家的作业啦 哈哈,FILENAME结构就可以,另外,小弟的新群,望各位大牛小牛统统加入,来者不拒:213382739
音乐播放器.rar
(426.43 KB)
#include <windows.h> #pragma comment( lib, "Winmm.lib" ) #include <stdio.h> #include <conio.h> int main() { MCI_OPEN_PARMSA mciopen; mciopen.lpstrElementName = "d:\\te st\\彩云追月.mp3"; if( 0 == mciSendCommandA( NULL, MCI_OPEN, MCI_OPEN_ELEMENT, (DWORD_PTR)&mciopen ) ) { MCI_PLAY_PARMS mciplay; if( 0 == mciSendCommandA( mciopen.wDeviceID, MCI_PLAY, 0, (DWORD_PTR)&mciplay ) ) { for( printf( "%s\n", "Is playing...(press any key to stop)" ); _kbhit()==0; Sleep(1) ); mciSendCommandA( mciopen.wDeviceID, MCI_STOP, 0, 0 ); } else { printf( "[error] %s\n", "MCI_PLAY" ); } mciSendCommandA( mciopen.wDeviceID, MCI_CLOSE, 0, 0 ); } else { printf( "[error] %s\n", "MCI_OPEN" ); } return 0; }