你是否正在寻找关于winmm.dll的内容?让我把最实时的东西奉献给你:
.net 播放音频(使用winmm.dll)
项目中需要从读取image流, 为MP3文件二进制.需要直接播放.经过查找 试用以下方法:
1. 使用winmm.dll中的sndPlaySoundA方法, 此方法可直接播放二进制数组, 但只能播放波形文件.
//声明
[DllImport("winmm.dll")]
private static extern int sndPlaySoundA(byte[] lpszSoundName, int uFlags);
//调用
private const int SND_MEMORY = 0x4;
private const int SND_ASYNC = 0x1;
sndPlaySoundA(byteArray, SND_MEMORY);
2. 使用winmm.dll中的PlaySound方法, 此方法可播放硬盘中的文件,同样只支持波形文件.
[DllImport("winmm.dll")]
public static extern long PlaySound(string lpszName, int hModule, int dwFlags);
PlaySound("FilePath", 0, 0);
3. 使用winmm.dll中的mciSendString方法调用wm播放音频或视频, 貌似只支持文件.
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand,
string strReturn, int iReturnLength, IntPtr hwndCallback);
只能用第3种方法了. 先把得到的流保存为文件, 再播放该文件.
以下为mciSendString方法指令, 转载自网络.
mciSendString
posted @
以上就是关于winmm.dll的全部内容,相信你一定会非常满意,。
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/shenmilingyu/article-5358-1.html
面