Muting sound problem

Here's the code I'm trying to use to mute my Vista system. I'm writing a code to put in the schools log-in script to mute the sound on Vista machines, as requested by the IT at my school. It runs without error, but doesn't do anything. I ran it in debug mode and hr always held the value S_OK. Can anyone see what's wrong?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
HRESULT hr = S_OK;
	IMMDevice *defaultDevice = NULL;
	IAudioEndpointVolume *endpointVolume = NULL;

	hr = CoInitialize(NULL);

	IMMDeviceEnumerator *pEnumerator = NULL;
	const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
	const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
	hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator);

	hr = pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &defaultDevice);

	hr = defaultDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL, (LPVOID *)&endpointVolume);

	hr = endpointVolume->SetMasterVolumeLevel(0.01,NULL);
Topic archived. No new replies allowed.