Click here to Skip to main content
15,883,961 members
Articles / Programming Languages / C++/CLI

Changing your Windows audio device programmatically using VC++

Rate me:
Please Sign up or sign in to vote.
5.00/5 (9 votes)
23 Dec 2008CPOL6 min read 132.7K   2.9K   31  
How to launch and manipulate applets programmatically.
#pragma once

//you must supply the next two machine dependent definitions
#define AUDIO_DEVICE_1			_T("Realtek HD Audio output")
#define AUDIO_DEVICE_2			_T("CreamWare Play/Rec 1")

#define APPLET				_T("mmsys.cpl")
#define APPLET_WINDOW_TITLE		_T("Sounds and Audio Devices Properties")
#define NONE				-1
#define MAX_ERR_SIZE			256 //error message buffer size
#define DCAST(x,y)			dynamic_cast<x>(y)
#define AUDIO_DEVICE_1_MODE		false
#define AUDIO_DEVICE_2_MODE		true
#define	WAIT_COUNT			1000
#define TARGET_SIZE			128

//gleaned from "Spy++"
#define SYS_TAB_CTRL			_T("SysTabControl32")
#define BUTTON				_T("Button")
#define COMBO_BOX			_T("ComboBox")
#define APPLY_BUTTON			_T("&Apply")

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer (Senior)
United States United States
Brian Odlum is a retired software engineer who spent twenty years in the industry. He learned more than a dozen programming languages and worked with all of them in a variety of programming environments and operating systems.

He now considers himself a serious composer of computer music, dabbles in video game level development, and likes to spend at least three months of every year living in a foreign country.

Comments and Discussions