我使用win32api函数编写了一个应用程序来获取和设置混音器音量。我遇到一个问题,需要将混音器音量调到我的应用程序(检索值)。 GetVolume -
public static int GetVolume()
{ //method level variables
int currVolume;
int mixerControl;
//create a new volume control
VolumeStructs.Mixer mixer = new VolumeStructs.Mixer();
//open the mixer
PCWin32.mixerOpen(out mixerControl, 0, 0, 0, 0);
//set the type to volume control type
int type = VolumeConstants.MIXERCONTROL_CONTROLTYPE_VOLUME;
//get the mixer control and get the current volume level
GetMixer(mixerControl, VolumeConstants.MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, type, out mixer, out currVolume);
//close the mixer control since we are now done with it
PCWin32.mixerClose(mixerControl);
//return the current volume to the calling method
return currVolume;
}