I'm using this code to mute/unmute system master volume:
const
APPCOMMAND_VOLUME_MUTE = $80000;
WM_APPCOMMAND = $319;
procedure TForm1.Button1Click(Sender: TObject);
begin
// toggle mute/unmute
SendMessageW(Handle, WM_APPCOMMAND, Handle, APPCOMMAND_VOLUME_MUTE);
end;
(Got the code from https://stackoverflow.com/a/154128/1140885)
It works fine on XP (Didn't test it on Win7 yet).
I need a method to check (get) what is the current "mute" state? Is it mute or not.
Any ideas?
Update: For XP I ended up using the code from here: How to get the master volume in windows xp? (Thanks to @Sertac Akyuz)
I had to change only a single line:
mxlc.dwControlType := MIXERCONTROL_CONTROLTYPE_VOLUME;
to:
mxlc.dwControlType := MIXERCONTROL_CONTROLTYPE_MUTE;
return value is either 0 (not mute) or 1 (mute).