如题
我要的效果是能用WMP播放一个声音文件,但是其他的电脑上没有这个文件。
只能封装到exe里面,或者说exe文件跟mp3文件在同一文件夹下这个程序能够访问到mp3文件。(主要是不知道怎么填播放路径。)

解决方案 »

  1.   

    System.AppDomain.CurrentDomain.BaseDirectory + "\\1.mp3"
      

  2.   

    我用System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase+"*.mp3";
    在VS里面调试的时候可以用,但是把生成的EXE文件和MP3文件换个文件夹就不行了,会出错。为什么?
      

  3.   

    不为什么,因为你设置的路径错误.将 System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase+"*.mp3";
    MessageBox.show出来,基本上就知道问题发生在哪里了.
      

  4.   

    Quote: 引用 5 楼 Lost_Painting 的回复:

    不为什么,因为你设置的路径错误.将 System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase+"*.mp3";
    MessageBox.show出来,基本上就知道问题发生在哪里了.我已经用messagebox.show()了,在VS里面的时候路径是对的,也能正常播放那个声音文件。但是我把生成的EXE和MP3文件换个文件夹就会出错
    wmp1.url=System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase+"\\*.mp3"
      

  5.   

    wmp1.url=System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase+"\\*.mp3