Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. public class WSounds
  2.   {
  3.     [DllImport("WinMM.dll")]
  4.     public static extern bool  PlaySound(string fname, int Mod, int flag);
  5.  
  6.     // these are the SoundFlags we are using here, check mmsystem.h for more
  7.     public int SND_ASYNC    = 0x0001;     // play asynchronously
  8.     public int SND_FILENAME = 0x00020000; // use file name
  9.     public int SND_PURGE    = 0x0040;     // purge non-static events
  10.  
  11.     public void Play(string fname, int SoundFlags)
  12.     {
  13.       PlaySound(fname, 0, SoundFlags);
  14.     }
  15.  
  16.     public void StopPlay()
  17.     {
  18.       PlaySound(null, 0, SND_PURGE);
  19.     }
  20.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement