【C#学习笔记】播放wma/mp3文件

using System;
using System.Runtime.InteropServices;

namespace ConsoleApplication
{
    class Program
    {
        [DllImport("winmm.dll")]
        public static extern uint mciSendString(string lpstrCommand,string lpstrReturnString, uint uReturnLength, uint hWndCallback);
        static void Main(string[] args)
        {
/*
指令及参数 功能
    open    设备名称 [type设备型式] [alias别名]           开启拨放设备
    close   设备名称                                    关闭拨放设备
    play    设备名称 [from起点] [to终点]                 播放
    pause   设备名称                                    暂停
    resume  设备名称                                    恢复播放(暂停要继续拨放时使用)
    seek    设备名称 [to位置 | to start | to end]        移到
    stop    设备名称                                    停止
*/
            mciSendString("play"+" "+@"01.mp3", null, 0, 0); 

            Console.Read();
        }      
    }
}
原文地址:https://www.cnblogs.com/tiandsp/p/7440441.html