网站大量收购闲置独家精品文档,联系QQ:2885784924

案例6:播放音频文件精品.ppt

  1. 1、本文档共38页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
案例6:播放音频文件精品

* 成都信息工程学院 计算机学院 编程步骤(7) 在OnBtnGo() 中添加播放媒体文件的代码 UpdateData(); m_hMCI = MCIWndCreate( NULL, NULL, WS_POPUP| MCIWNDF_NOPLAYBAR| MCIWNDF_NOMENU, m_strFilePath); MCIWndPlay(m_hMCI); * 成都信息工程学院 计算机学院 MCIWndCreate HWND MCIWndCreate( HWND hwndParent, HINSTANCE hInstance, DWORD dwStyle, LPSTR szFile ); The MCIWndCreate function registers the MCIWnd window class and creates an MCIWnd window for using MCI services. MCIWndCreate can also open an MCI device or file (such as an AVI file) and associate it with the MCIWnd window. Parameters szFile Null-terminated string indicating the name of an MCI device or data file to open. Return Values Returns the handle to an MCI window if successful or zero otherwise. * 成都信息工程学院 计算机学院 MCIWndPlay #define MCIWndPlay(hwnd) (LONG)MCIWndSM(hwnd, MCI_PLAY, 0, 0) The MCIWndPlay macro sends a command to an MCI device to start playing from the current position in the content. Parameters hwnd Handle of the MCIWnd window. * 成都信息工程学院 计算机学院 编程步骤(8) 为“Stop”按钮添加Click消息的响应函数 * 成都信息工程学院 计算机学院 编程步骤(8) 在OnBtnStop () 中添加停止播放的代码 if(m_hMCI!=NULL) { MCIWndClose(m_hMCI); // close an open movie MCIWndDestroy(m_hMCI); m_hMCI=NULL; } * 成都信息工程学院 计算机学院 MCIWndClose #define MCIWndClose(hwnd) \ (LONG)MCIWndSM(hwnd, MCI_CLOSE, 0, 0) The MCIWndClose macro closes an MCI device or file associated with an MCIWnd window. Although the MCI device closes, the MCIWnd window is still open and can be associated with another MCI device. * 成都信息工程学院 计算机学院 编译、运行 * 成都信息工程学院 计算机学院 MCIWndDestroy #define MCIWndDestroy(hwnd) \ (VOID)MCIWndSM(hwnd, WM_CLOSE, 0, 0) The MCIWndDestroy macro closes an MCI device or file associated with an MCIWnd window and destroys the window. VC++程序设计 成都信息工程学院 计算机学院 成都信息工程学院 计算机学院 * 成都信息工程学院 计算机学院 案例6:播放音频文件 * 成都信息工程学院 计算机学院 需求与目标 在多媒体程序的设计中经常需要处理声音文件。 * 成都信息工程学院 计算机学院 思路 媒体控制接口(MCI)提供了控制多媒体设备的一组与设备无关的命令消息和命令串。 Wondows支持两种RIFF(Resource Interchage File Format——资源交互文件格式)音频文件:MIDI文件和WAV文件。 本例子说明MIDI文件的播放方法。 * 成都信息工程学院 计算机学院 思路 程序只

文档评论(0)

bodkd + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档