cplusplus.com cplusplus.com
cplusplus.com   C++ : Forums : Windows Programming : Muting sound problem
  Search:
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forums
Forums
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programm...
Articles
Lounge
Jobs

-

post  Muting sound problem

SnapCrakllPop (13)
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);
|

This topic is archived - New replies not allowed.
Home page | Privacy policy
© cplusplus.com, 2000-2009 - All rights reserved - v2.2
Spotted an error? contact us