這個類可以直接播放mp3文件
使用方式:
clsMCI cm = new clsMCI();
cm.FileName = "別看我只是一只羊.mp3";
cm.play();
類代碼
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.IO ;
using System.Windows.Forms;
namespace WindowsApplication7
{
/// <summary>
/// clsMci 的摘要說明。
/// </summary>
public class clsMCI
{
public clsMCI()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
//定義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 = 2,
mStop = 3
};
//結構變量
public struct structMCI
{
public bool bMut;
public int iDur;
public int iPos;
public int iVol;
public int iBal;
public string iName;
public State state;
};
public structMCI mc =new structMCI() ;
//取得播放文件屬性
public string FileName
{