Advertisement
Guest User

pInvoke used in real WP7 app

a guest
Mar 8th, 2012
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. public static class Core
  2. {
  3.     public static void Mute()
  4.     {
  5.         uint num = 0;
  6.         Core.waveOutGetVolume(IntPtr.Zero, out num);
  7.         Core.waveOutSetVolume(IntPtr.Zero, 0);
  8.         IsolatedStorageSettings.ApplicationSettings.AddOrUpdateValue("volume", num);
  9.     }
  10.  
  11.     public static void UnMute()
  12.     {
  13.         if (IsolatedStorageSettings.ApplicationSettings.Contains("volume"))
  14.         {
  15.             uint item = (uint)IsolatedStorageSettings.ApplicationSettings["volume"];
  16.             Core.waveOutSetVolume(IntPtr.Zero, item);
  17.         }
  18.     }
  19.  
  20.     [DllImport("coredll.dll", CharSet=CharSet.None)]
  21.     private static extern int waveOutGetVolume(IntPtr device, out uint volume);
  22.  
  23.     [DllImport("coredll.dll", CharSet=CharSet.None)]
  24.     private static extern int waveOutSetVolume(IntPtr device, uint volume);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement