【发布时间】:2010-11-11 18:28:00
【问题描述】:
我需要播放 mp3 文件。我想使用 winmm.dll (Windows 7)
class Program
{
[DllImport("winmm.dll")]
private static extern long mciSendString(string Cmd, StringBuilder StrReturn, int ReturnLength, IntPtr HwndCallback);
static void Main(string[] args)
{
string FileName = @"F:\MUSIC\ROCK.mp3";
string CommandString = "open " + "\"" + FileName + "\"" + " type mpegvideo alias Mp3File";
mciSendString(CommandString, null, 0, IntPtr.Zero);
CommandString = "play Mp3File";
mciSendString(CommandString, null, 0, IntPtr.Zero);
Console.ReadKey();
}
}
但是当我运行我的程序时,什么也没发生。 哪里出错了?
【问题讨论】: