我有這個類我在一個網站上找到:如何使用C#暫停MP3文件?
class MP3Handler
{
private string _command;
private bool isOpen;
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);
public void Close()
{
_command = "close MediaFile";
mciSendString(_command, null, 0, IntPtr.Zero);
isOpen = false;
}
public void Open(string sFileName)
{
_command = "open \"" + sFileName + "\" type mpegvideo alias MediaFile";
mciSendString(_command, null, 0, IntPtr.Zero);
isOpen = true;
}
public void Play(bool loop)
{
if (isOpen)
{
_command = "play MediaFile";
if (loop)
_command += " REPEAT";
mciSendString(_command, null, 0, IntPtr.Zero);
}
}
}
是有停止和播放的方法。我想知道是否有人熟悉winmm.dll庫。如何在播放歌曲時暫停歌曲,然後從暫停的地方繼續播放歌曲?
,做播放,暫停等,使用項目WINMM.DLL:http://www.codeproject.com/KB/audio-video/ Audio_Player__with_Winmm.aspx – 2009-11-09 23:58:35