ライブラリをリンクする
#pragma comment(lib,"winmm")
ウインドウの WndProc関数部分の一部
//MCI関係 static MCI_OPEN_PARMS mop; int iErr; TCHAR strErr[1024]; case IDM_MCI_CMD://MCIコマンド実行 mop.dwCallback = (DWORD)hWnd; mop.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_WAVEFORM_AUDIO; mop.lpstrElementName = "G:\\sampleMovie\\sample.wav"; iErr = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID | MCI_OPEN_ELEMENT , (DWORD)&mop); if (iErr) { mciGetErrorString(iErr , strErr , 1024); MessageBox(hWnd , strErr , NULL , MB_OK); } mciSendCommand(mop.wDeviceID , MCI_PLAY , 0 , 0); break;
終了時
mciSendCommand(mop.wDeviceID , MCI_CLOSE , 0 , 0);
動画の再生
//MCI関係 static MCI_ANIM_OPEN_PARMS maop; static MCI_ANIM_PLAY_PARMS mapp; int iErr; TCHAR strErr[1024]; case IDM_MCI_CMD://MCIコマンド実行 maop.dwCallback = (DWORD)hWnd; maop.lpstrDeviceType = NULL; maop.lpstrElementName = "G:\\sampleMovie\\avi_divx5_mp3.avi"; maop.dwStyle = WS_CHILD | WS_VISIBLE; maop.hWndParent = hWnd; iErr = mciSendCommand(0 , MCI_OPEN , MCI_OPEN_ELEMENT | MCI_ANIM_OPEN_PARENT | MCI_ANIM_OPEN_WS , (DWORD)&maop); if (iErr) { mciGetErrorString(iErr , strErr , 1024); MessageBox(hWnd , strErr , NULL , MB_OK); } mapp.dwCallback = (DWORD)hWnd; mciSendCommand(maop.wDeviceID , MCI_PLAY , 0 , (DWORD)&mapp); break;
0 件のコメント:
コメントを投稿