日期:2014-05-17  浏览次数:20960 次

AxWindowsMediaPlayer 的URL路径写什么?
AxWindowsMediaPlayer 的URL路径写什么,是mp3的路径么?

AxWindowsMediaPlayer mediaPlayer = new AxWindowsMediaPlayer() ;
mediaPlayer.URL = "D:\\mp3\\Kalimba.mp3";
mediaPlayer.uiMode = "None";
mediaPlayer.Ctlenabled = true;
mediaPlayer.Ctlcontrols.play();


这URL怎么错了 ,应该怎么写。
文件路径没问题
C#

------解决方案--------------------
短格式的路径,你自己百度吧。
在widnows里有个api函数可以获取短格式的路径。
引用:
  [DllImport("Kernel32", CharSet = CharSet.Auto)]
        static extern Int32 GetShortPathName(String path,StringBuilder shortPath, Int32 shortPathLength);

 调用:     
            StringBuilder shortpath=new StringBuilder(80);
            int result = GetShortPathName(MusicFile, shortpath, shortpath.Capacity);
            MusicFile = shortpath.ToString();

MusicFile,这个参数是你现在的路径。
shortpath,这个参数是api函数返回的短路径。