新手,不懂怎么入手,请教各位了!

解决方案 »

  1.   

    [DllImport("coredll.dll")]
            public static extern int PlaySound(string szSound, IntPtr hModule, int flags);
     public enum PlaySoundFlags : int
            {
                SND_SYNC = 0x0,     // play synchronously (default)
                SND_ASYNC = 0x1,    // play asynchronously
                SND_NODEFAULT = 0x2,    // silence (!default) if sound not found
                SND_MEMORY = 0x4,       // pszSound points to a memory file
                SND_LOOP = 0x8,     // loop the sound until next sndPlaySound
                SND_NOSTOP = 0x10,      // don't stop any currently playing sound
                SND_NOWAIT = 0x2000,    // don't wait if the driver is busy
                SND_ALIAS = 0x10000,    // name is a registry alias
                SND_ALIAS_ID = 0x110000,// alias is a predefined ID
                SND_FILENAME = 0x20000, // name is file name
                SND_RESOURCE = 0x40004, // name is resource name or atom
            };
    PlaySound("path", IntPtr.Zero, (int)(PlaySoundFlags.SND_FILENAME | PlaySoundFlags.SND_SYNC));
                
      

  2.   

    我测试没有通过啊,系统上为什么既没有错误提示,也不播放我的wav文件呢?
      

  3.   

    那时你程序的问题。我的mobile5上播放的很好。
      

  4.   

    PlaySound(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)+"warning.wav", IntPtr.Zero, (int)(Flags.SND_FILENAME | Flags.SND_SYNC));
      

  5.   

    PlaySound(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)+"\\warning.wav", IntPtr.Zero, (int)(Flags.SND_FILENAME ¦ Flags.SND_SYNC));
      

  6.   

      我是加了"\\"的,忘记打出来了````我的调用方法是正确的,为什么我这边测试就是不播放那个wav文件呢?
      

  7.   

    我这边的测试用的ppc也是mobil 5.0的
      

  8.   

      不好意思,是我自己的mobile没设置得到的问题,现在OK了```谢谢你了`