2013/12/23

C#.Net 透過Windows Media Player 播放 WMV檔案

將WMPLib.dll加入參考



程式碼:
using System;
using WMPLib;


namespace PlayMedia
{
    class Program
    {
        private static readonly WindowsMediaPlayer meiadPlayer = new WindowsMediaPlayer();
        private static string path = @"C:\Users\CY\Desktop\1dde0910.wmv";

        static void Main(string[] args)
        {

            meiadPlayer.openPlayer(path);     
            Console.Read();
        }
    }
}


執行結果:

參考資料:
http://stackoverflow.com/questions/56478/how-to-interact-with-windows-media-player-in-c-sharp

影片來源:
http://blog.yam.com/a25601928/article/16023370