Created
January 8, 2016 05:20
-
-
Save zenden2k/c088daab3762174a6219 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requires Windows 7 or later | |
_COM_SMARTPTR_TYPEDEF(IAudioSessionManager2, __uuidof(IAudioSessionManager2)); | |
bool MuteCurrentProcess() { | |
IAudioSessionManager2Ptr mgr; | |
CreateSessionManager(&mgr); | |
ISimpleAudioVolumePtr volume; | |
if (SUCCEEDED(mgr->GetSimpleAudioVolume(&GUID_NULL, false, &volume))) { | |
ISimpleAudioVolumePtr vol; | |
volume->QueryInterface(__uuidof(IAudioEndpointVolume), (void**)&vol); | |
if (SUCCEEDED(volume->SetMute(TRUE, 0))) { | |
return true; | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment