这个是一段例程,希望能对你有帮助
[DllImport("Winmm")]
public static extern bool PlaySound(string pszSound, IntPtr hmod, UInt32
fdwSound);
private const Int32 SND_ASYNC = 1;
private const Int32 SND_LOOP = 8;
private const Int32 SND_FILENAME = 131072;
private void PlayScreenSaver()
{
PlaySound ("BackGround.WAV", IntPtr.Zero, SND_ASYNC | SND_FILENAME |
SND_LOOP);
……
}
private void StopScreenSaver()
{
PlaySound (null, IntPtr.Zero, SND_ASYNC);
……
}
更详细的信息可以到这里看看
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/mmfunc_9uxw.asp