这个是从别人的blog是看到的.
经过我的验证,完全可以使用,而且不仅支持mp3,还支持wma,wmv.播放wmv的话会自动弹出一个视频播放小窗口.
代码:
using
System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO ;
using System.Windows.Forms;
namespace winformFlash
... {
/**//// <summary>
/// 用Win32Api实现的媒体播放类.支持Mp3,wma,wmv
/// </summary>
class Mp3
...{
public Mp3()
...{
}
//定义API函数使用的字符串变量
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string Name = "";
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
private string durLength = "";
[MarshalAs(UnmanagedType.LPTStr, SizeConst = 128)]
private string TemStr = "";
int ilong;
//定义播放状态枚举变量
public enum State
...{
mPlaying = 1,
mPuase =
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO ;
using System.Windows.Forms;
namespace winformFlash
... {
/**//// <summary>
/// 用Win32Api实现的媒体播放类.支持Mp3,wma,wmv
/// </summary>
class Mp3
...{
public Mp3()
...{
}
//定义API函数使用的字符串变量
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string Name = "";
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
private string durLength = "";
[MarshalAs(UnmanagedType.LPTStr, SizeConst = 128)]
private string TemStr = "";
int ilong;
//定义播放状态枚举变量
public enum State
...{
mPlaying = 1,
mPuase =