1、引用命名空间:using System.Runtime.InteropServices;
2、创建类: 加入以下代码块
[DllImport("winmm.dll")]
public static extern long PlaySound(String fileName, long a, long b);
3、使用:类名+方法名,默认a,b为0即可
MusicPlayer.PlaySound(@"E:\newOrder.wav", 0, 0);
总结:相比于使用DirectX、System.Media.SoundPlayer(wav文件有时候会报错:“Sound API only supports playing PCM wave files.”,也没找到解决方法)