这个东西也是参考的CSDN上很多素材,之前用也是好好的;后来重装了系统之后运行发现就没有音了;再后来鼓捣了半天,发现虽然很囧RZ的说,似乎只有MP3放不出来声音,WAV和WMA都很正常..谁能帮帮忙解决一下?      using System.Runtime.InteropServices;       public static uint SND_ASYNC = 0x0001;  // play asynchronously 
        public static uint SND_FILENAME = 0x00020000; // name is file name
        [DllImport("winmm.dll")]
        public static extern uint mciSendString(string lpstrCommand,
        string lpstrReturnString, uint uReturnLength, uint hWndCallback);
            mciSendString(@"close temp_alias", null, 0, 0);
            mciSendString(@"open ""D:\Base\Music\01.mp3"" alias temp_alias",
                null, 0, 0);
            mciSendString("play temp_alias repeat", null, 0, 0); 

解决方案 »

  1.   

    Windows Media Player播发
    using System.Media;   
    using System.IO;   
    SoundPlayer music = new SoundPlayer();   
    music = new SoundPlayer("");   
    music.Play();   
    或   
    [DllImport("winmm.dll")]   
    public static extern long PlaySound(String fileName,long a,long b);   [DllImport("winmm.dll")]   
      public static extern long mciSendString(string lpstrCommand,string lpstrReturnString,long length,long hwndcallback);   
      public static void PlayMusic(string p_FileName)   
      {   
      try   
      {   
      mciSendString(@"close "+p_FileName ,"",0,0);   
      mciSendString(@"open " + p_FileName,"",0,0);   
      mciSendString(@"play " + p_FileName ,"",0,0);   
      }   
      catch   
      {   
      }   
      }   
     
     
      

  2.   


    那个WMP不是太想用..soundplayer好像只能播放WAV,我主要想播放MP3。上面的代码试了一下,没能解决~同样还是MP3播放不能,wav或是wma正常。也不知道为什么。这段代码明明半个月前用着还好好的。
      

  3.   

    好像是我的机器有问题还是怎么的;在CSDN下载那里下了好几个MP3播放器、都是用MCI播放的,结果同样都是MP3播放不能,其他格式倒是没问题..谁能好心帮忙解决一下吗?致命啊!
      

  4.   

    能教我怎么确认吗?我这边用TTPLAYER放MP3还是正常的..拜托了!