MCI_windows编程实现实例(2)

发布时间:2021-06-06

MCI_windows编程实现实例

五、使用示例

1. sndPlaySound("ding.wav",SND_SYNC);

2. PlaySound("chord.wav",NULL,SND_SYNC );

3. 使用两个高级MCI函数

a. 播放MIDI文件示例

{

HWND hwnd;

MCI_OPEN_PARMS mciopen;

MCI_OPEN_PARMS mciplay;

DWORD rtrn;

char b[80];

hwndGetActiveWindow()->m_hWnd;

= mciopen.lpstrElementName = "e:\\test\\test.rmi";

rtrn = mciSendCommand(0,MCI_OPEN,MCI_OPEN_TYPE|MCI_OPEN_ELEMENT, (DWORD)(LPVOID)&mciopen); if(rtrn != 0){

mciGetErrorString(rtrn,(LPSTR)b,80);

::MessageBox(hwnd,b,"MCI ERROR!",MB_OK);

}

wDeviceID = mciopen.wDeviceID; mciplay.dwCallback = (DWORD)hwnd; rtrn = mciSendCommand(wDeviceID,MCI_PLAY,MCI_NOTIFY,(DWORD)(LPVOID)&mciplay); if (rtrn != 0L){ mciopen.lpstrDeviceType = "sequencer" ; =

mciGetErrorString(rtrn,(LPSTR)b,80);

::MessageBox(hwnd,b,"MCI Error",MB_OK);

mciSendCommand(wDeviceID,MCI_CLOSE,0,NULL);

}

}

//停止播放

{

HWND hwnd;

MCI_GENERIC_PARMS mcistop;

hwndGetActiveWindow()->m_hWnd;

} mcistop.dwCallback = (DWORD)hwnd; mciSendCommand(MCI_DEVTYPE_SEQUENCER,MCI_STOP,0,(DWORD)(LPVOID)&mcistop);

MCI_windows编程实现实例(2).doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219