Do you want to
mute the device, or change the volume in managed code?
Then you can use the following property:
29 public enum Volumes : int
30 {
31 OFF = 0,
32 LOW = 858993459,
33 NORMAL = 1717986918,
34 MEDIUM = -1717986919,
35 HIGH = -858993460,
36 VERY_HIGH = -1
37 }
38
39 [DllImport("coredll.dll", SetLastError = true)]
40 public static extern int waveOutSetVolume(IntPtr device, int volume);
41
42 [DllImport("coredll.dll", SetLastError = true)]
43 public static extern int waveOutGetVolume(IntPtr device, ref int volume);
44
45 public static Volumes Volume
46 {
47 get
48 {
49 int v = (int)0;
50
51 waveOutGetVolume(IntPtr.Zero, ref v);
52
53 switch (v)
54 {
55
56 case (int)Volumes.OFF:
57 return Volumes.OFF;
58
59 case (int)Volumes.LOW:
60 return Volumes.LOW;
61
62 case (int)Volumes.NORMAL:
63 return Volumes.NORMAL;
64
65 case (int)Volumes.MEDIUM:
66 return Volumes.MEDIUM;
67
68 case (int)Volumes.HIGH:
69 return Volumes.HIGH;
70
71 case (int)Volumes.VERY_HIGH:
72 return Volumes.VERY_HIGH;
73
74 default:
75 return Volumes.OFF;
76 }
77 }
78 set { waveOutSetVolume(IntPtr.Zero, (int)value); }
79 }
The change will appear in 3 or 5 seconds.
So it means,
it isn't a fast operation. :(
You can download the source code from:
http://www.winmobile.euweb.cz/#Post04