为什么 MCI_OPEN 失败并返回无效的设备 ID?
dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT | MCI_OPEN_TYPE
, (DWORD_PTR)(LPVOID) &mciOpenParms);
错误消息是“设备名称已被此应用程序用作别名。请使用唯一的别名。”
为什么会出错?
dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT | MCI_OPEN_TYPE
, (DWORD_PTR)(LPVOID) &mciOpenParms);
error -message is "The device name is already being used as an alias by this application. Use a unique alias."
Why is it giving an error ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然从技术上讲是正确的,但这个答案对我没有多大帮助。
“如果在最初打开设备或文件时未指定 MCI_OPEN_SHAREABLE 标志,则对该设备或文件的所有后续 MCI_OPEN 命令都将失败。”
我发现我必须在任何 MCI_OPEN 之前执行 MCI_CLOSE,如下所示:
另外,这里有一篇关于对这些音频设备进行编程的非常好的文章。
http:// www.c-sharpcorner.com/uploadfile/GemingLeader/creating-a-sound-recorder-in-c-and-C-Sharp/
While technically correct, this answer didn't help me much.
"If the MCI_OPEN_SHAREABLE flag is not specified when a device or file is initially opened, all subsequent MCI_OPEN commands to the device or file will fail."
I found I had to do an MCI_CLOSE before any MCI_OPEN, like this:
Also, here is a very nice article on programming these audio devices.
http://www.c-sharpcorner.com/uploadfile/GemingLeader/creating-a-sound-recorder-in-c-and-C-Sharp/
当尝试重新打开已打开的 mci 设备时可能会发生这种情况。
如果在最初打开设备或文件时未指定 MCI_OPEN_SHAREABLE 标志,则对该设备或文件的所有后续 MCI_OPEN 命令都将失败。
This might happen when one attempts to reopen an already opened mci device.
If the MCI_OPEN_SHAREABLE flag is not specified when a device or file is initially opened, all subsequent MCI_OPEN commands to the device or file will fail.