資源簡介
C++寫的超簡單的MP3音頻播放程序
MP3音頻播放程序,估計找不到比這個再簡單的程序了,本人剛學C,只能寫出這么樣的,我感覺對我的菜鳥同行有不小幫助,確實太簡單了,不用擔心你會看不懂。不涉及VC的知識。

代碼片段和文件信息
/*----------------------------------------
???BTNLOOK.C?--?Button?Look?Program
????????????????(c)?Charles?Petzold?1998
??----------------------------------------*/
#include?
#include?
void?PopFileInitialize?(HWND)?;
BOOL?PopFileOpenDlg????(HWND?PTSTR?PTSTR)?;
void?paly_mp3(char?*dress);
void?pause_mp3();
void?reset_mp3();
struct
{
?????int?????istyle?;
?????TCHAR?*?szText?;
}
button[]?=
{
?????BS_PUSHBUTTON???TEXT?(“打開“)
?????BS_PUSHBUTTON???TEXT?(“播放“)
?????BS_PUSHBUTTON???TEXT?(“暫停“)?
?BS_PUSHBUTTON???TEXT?(“重置“)
?????BS_PUSHBUTTON???TEXT?(“退出“)
}?;
#define?NUM?(sizeof?button?/?sizeof?button[0])
TCHAR?szAppName[]?=?TEXT?(“BtnLook“)?;
LRESULT?CALLBACK?WndProc?(HWND?UINT?WPARAM?LPARAM)?;
int?WINAPI?WinMain?(HINSTANCE?hInstance?HINSTANCE?hPrevInstance
????????????????????PSTR?szCmdLine?int?iCmdShow)
{
?????HWND?????????hwnd?;
?????MSG??????????msg?;
?????WNDCLASS?????wndclass?;
?????
?????wndclass.style?????????=?CS_HREDRAW?|?CS_VREDRAW?;
?????wndclass.lpfnWndProc???=?WndProc?;
?????wndclass.cbClsExtra????=?0?;
?????wndclass.cbWndExtra????=?0?;
?????wndclass.hInstance?????=?hInstance?;
?????wndclass.hIcon?????????=?LoadIcon?(NULL?IDI_APPLICATION)?;
?????wndclass.hCursor???????=?LoadCursor?(NULL?IDC_ARROW)?;
?????wndclass.hbrBackground?=?(HBRUSH)?GetStockobject?(WHITE_BRUSH)?;
?????wndclass.lpszMenuName??=?NULL?;
?????wndclass.lpszClassName?=?szAppName?;
?????
?????if?(!RegisterClass?(&wndclass))
?????{
??????????MessageBox?(NULL?TEXT?(“This?program?requires?Windows?NT!“)
??????????????????????szAppName?MB_IConerror)?;
??????????return?0?;
?????}
?????
?????hwnd?=?CreateWindow?(szAppName?TEXT?(“播放音頻程序“)
??????????????????????????WS_OVERLAPPEDWINDOW
??????????????????????????200?200
??????????????????????????290?170
??????????????????????????NULL?NULL?hInstance?NULL)?;
?????
?????ShowWindow?(hwnd?iCmdShow)?;
?????UpdateWindow?(hwnd)?;
?????
?????while?(GetMessage?(&msg?NULL?0?0))
?????{
??????????TranslateMessage?(&msg)?;
??????????DispatchMessage?(&msg)?;
?????}
?????return?msg.wParam?;
}
LRESULT?CALLBACK?WndProc?(HWND?hwnd?UINT?message?WPARAM?wParam?LPARAM?lParam)
{
?????static?HWND??hwndButton[NUM]?;
?static?RECT?rect;
?????static?HDC?hdc?;
?static?TCHAR?szBuffer[50];
?static?TCHAR?szTop[]?=?TEXT(“選擇的歌曲是:“);
?static?TCHAR?szFileName[MAX_PATH]?sztitleName[MAX_PATH]?;
?????static?int?cxChar?cyChar?;
?static?PAINTSTRUCT??ps?;
?static?int?i;
?????switch?(message)
?????{
?????case?WM_CREATE?:
??cxChar?=?LOWORD?(GetDialogbaseUnits?())?;
??????????cyChar?=?HIWORD?(GetDialogbaseUnits?())?;
??????????
??????????for?(i?=?0?;?i????????????????hwndButton[i]?=?CreateWindow?(?TEXT(“button“)?
???????????????????????????????????button[i].szText
???????????????????????????????????WS_CHILD?|?WS_VISIBLE?|?button[i].istyle
???????????????????????????????????cyChar?*?(1?+?3?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
-----------?---------??----------?-----??----
????????????????12900????????????????????7
- 上一篇:預測分析程序的實現
- 下一篇:往年廣東專插本考試C語言試題.zip
評論
共有 條評論