手机版

MCI_windows编程实现实例(3)

发布时间:2021-06-06   来源:未知    
字号:

MCI_windows编程实现实例

b.

{ 录音示例 =

HWND hwnd;

MCI_OPEN_PARMS mciopen;

MCI_RECORD_PARMS mci1;

MCI_SAVE_PARMS mcisave;

DWORD rtrn;

char b[80];

hwndGetActiveWindow()->m_hWnd;

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;

mci1.dwCallback = (DWORD)hwnd; rtrn = mciSendCommand(wDeviceID,MCI_RECORD,MCI_NOTIFY,(DWORD)(LPVOID)&mci1); if (rtrn != 0L){ mciopen.lpstrElementName = "e:\\ding.wav"; mcisave.lpfilename = "e:\\ding.wav"; mciopen.lpstrDeviceType = "waveaudio";

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

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

mciSendCommand(wDeviceID,MCI_CLOSE,0,NULL);

}

}

//保存到文件并停止录音

{

HWND hwnd;

MCI_SAVE_PARMS mcisave;

MCI_OPEN_PARMS mciopen;

DWORD rtrn;

char b[80];

hwndGetActiveWindow()->m_hWnd;

mcisave.dwCallback = (DWORD)hwnd; mciopen.lpstrElementName = "e:\\ding.wav"; mcisave.lpfilename = "e:\\ding.wav"; mciopen.lpstrDeviceType = "waveaudio";

MCI_windows编程实现实例(3).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
×
二维码
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)