Click here to Skip to main content
16,017,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How i can check master volume is mute or is unmute in C# programming??
I have this code:

C#
private const int APPCOMMAND_VOLUME_MUTE = 0x80000;
private const int WM_APPCOMMAND = 0x319;
[DllImport("user32.dll")]
public static extern IntPtr SendMessageW(IntPtr hWnd, int Msg, IntPtr wParam,IntPtr lParam);


but it does not give me volume status. this code just change the status.
Tnx
Posted
Updated 3-Apr-12 18:42pm
v5

You can do it with some complicated code using
C#
[DllImport("winmm.dll")]
public static extern int mixerGetControlDetails(IntPtr hmxobj,ref MIXERCONTROLDETAILS pmxcd, MIXER_GETCONTROLDETAILSFLAG fdwDetailsmixer);

Best option is to get the WaveLibMixer code by Gustavo Franco, e.g. from
http://volumehotkey.googlecode.com/svn-history/r2/trunk/WaveLibMixer/[^]
 
Share this answer
 
Comments
M.Ostadi 3-Apr-12 3:02am    
Can it change the Master volume (Speaker)?
chek this post here:

vb.net - how to check the master volume is muted or not - Stack Overflow[^]

you can easily convert code from vb to c#.
 
Share this answer
 
Comments
Richard Deeming 11-Nov-16 8:55am    
This question was answered over 4 ½ years ago - more than 2 ½ years before you joined.
Philippe Mori 11-Nov-16 16:14pm    
It does not matters if the answer give new information that could be useful when existing solution are poorly rated.
Richard Deeming 11-Nov-16 16:18pm    
But the existing solution is not "poorly rated" - it has a single vote of 3, which is neutral.

And this "solution" is nothing more than a link to a StackOverflow answer, with no explanation or context.
Member 11276984 12-Nov-16 1:27am    
i am getting same probelm and solution given here is not working for me other than the answer on link describe with code is working for me so that i posted here.
CHill60 12-Nov-16 21:04pm    
I think the point is, that you found the answer elsewhere. All you have done here is make an old question "new" again. If someone is looking for a similar answer don't you think they would have found that answer the same way you did? There is no need to duplicate the answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900