首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

获取系统现阶段输出音量,求解

2013-05-02 
获取系统当前输出音量,求解说起来有点蛋疼就是win7下面,右下角不是有个量化的音量控制器么(小喇叭那个)点

获取系统当前输出音量,求解
说起来有点蛋疼
就是win7下面,右下角不是有个量化的音量控制器么(小喇叭那个)
点开之后,可以看到有一个灰色的条和一个绿色的条,灰色的代表原本应该输出的音量(量化后的),绿色的代表真正输出音量,
这个怎么分别获取到呢? 音量
[解决办法]
1楼摘自MSDN98,以下摘自MSDN2008:(如有必要在MSDN2010中搜mixerGetControlDetails)
mixerGetControlDetails
The mixerGetControlDetails function retrieves details about a single control associated with an audio line.

MMRESULT mixerGetControlDetails(
  HMIXEROBJ hmxobj,             
  LPMIXERCONTROLDETAILS pmxcd,  
  DWORD fdwDetails              
);
Parameters

hmxobj

Handle to the mixer device object being queried.

pmxcd

Pointer to a MIXERCONTROLDETAILS structure, which is filled with state information about the control. 

fdwDetails

Flags for retrieving control details. The following values are defined.

Value Meaning 
MIXER_GETCONTROLDETAILSF_LISTTEXT The paDetails member of the MIXERCONTROLDETAILS structure points to one or more MIXERCONTROLDETAILS_LISTTEXT structures to receive text labels for multiple-item controls. An application must get all list text items for a multiple-item control at once. This flag cannot be used with MIXERCONTROL_CONTROLTYPE_CUSTOM controls. 
MIXER_GETCONTROLDETAILSF_VALUE Current values for a control are retrieved. The paDetails member of the MIXERCONTROLDETAILS structure points to one or more details structures appropriate for the control class.  
MIXER_OBJECTF_AUX The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by the auxGetNumDevs function. 
MIXER_OBJECTF_HMIDIIN The hmxobj parameter is the handle of a MIDI (Musical Instrument Digital Interface) input device. This handle must have been returned by the midiInOpen function. 
MIXER_OBJECTF_HMIDIOUT The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function. 
MIXER_OBJECTF_HMIXER The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional. 
MIXER_OBJECTF_HWAVEIN The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function. 
MIXER_OBJECTF_HWAVEOUT The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function. 
MIXER_OBJECTF_MIDIIN The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the number of devices returned by the midiInGetNumDevs function. 


MIXER_OBJECTF_MIDIOUT The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than the number of devices returned by the midiOutGetNumDevs function. 
MIXER_OBJECTF_MIXER The hmxobj parameter is the identifier of a mixer device in the range of zero to one less than the number of devices returned by the mixerGetNumDevs function. This flag is optional. 
MIXER_OBJECTF_WAVEIN The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of devices returned by the waveInGetNumDevs function. 
MIXER_OBJECTF_WAVEOUT The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of devices returned by the waveOutGetNumDevs function. 


Return Values

Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following. 

Value Description 
MIXERR_INVALCONTROL The control reference is invalid. 
MMSYSERR_BADDEVICEID The hmxobj parameter specifies an invalid device identifier. 
MMSYSERR_INVALFLAG One or more flags are invalid. 
MMSYSERR_INVALHANDLE The hmxobj parameter specifies an invalid handle. 
MMSYSERR_INVALPARAM One or more parameters are invalid. 
MMSYSERR_NODRIVER No mixer device is available for the object specified by hmxobj. 


Remarks

All members of the MIXERCONTROLDETAILS structure must be initialized before calling this function. 

Requirements

  Windows NT/2000/XP: Included in Windows NT 3.1 and later.
  Windows 95/98/Me: Included in Windows 95 and later.
  Header: Declared in Mmsystem.h; include Windows.h.
  Library: Use Winmm.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000/XP.

See Also

Audio Mixers, Audio Mixer Functions, MIXERCONTROLDETAILS, MIXERCONTROLDETAILS_LISTTEXT, auxGetNumDevs, midiInOpen, midiOutOpen, mixerOpen, waveInOpen, waveOutOpen, midiInGetNumDevs, midiOutGetNumDevs, mixerGetNumDevs, waveInGetNumDevs, waveOutGetNumDevs 

热点排行