关于mcisendcommand调节音量的问题

我想用mcisendcommand来调节播放的音乐的音量,但是无报错也无法调节。是一定要用mfc的滑块才能调节吗?希望各位能帮忙看一下,谢谢。

//这是播放音乐与MCI_DGV_SETAUDIO_PARMS的初始化阶段
MCI_OPEN_PARMS open;
open.lpstrDeviceType = NULL;
open.lpstrElementName = L"D:\编程c\five\Debug\music.wav";
mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_ELEMENT, (DWORD)&open);
DWORD wdd;
MCI_PLAY_PARMS play;
play.dwFrom = 0;//指定开始播放的位置,单位ms
wdd = open.wDeviceID;//wdd储存设备id
mciSendCommand(wdd, MCI_PLAY, MCI_FROM, (DWORD)&play);
int num, level;
MCI_DGV_SETAUDIO_PARMS volume;
volume.dwCallback = NULL;
volume.dwItem = MCI_DGV_SETAUDIO_VOLUME;
volume.dwValue = (DWORD)1000;
//这个函数用于调音量,k=1增大,k=0,减小。因为不知道是不是类型出错,所以写的很小心。
int turnvolume(MCI_DGV_SETAUDIO_PARMS& a,int k) {
if (k == 1&&((int)a.dwValue+100)>=1000) {
a.dwValue = 1000; return 0;
}
if (k == 1) {
a.dwValue = (WORD)((int)a.dwValue + 100); return 0;
}
if (k == 0 && ((int)a.dwValue - 100) <= 0) {
a.dwValue = 0;
return 0;
}
if (k == 0) {
a.dwValue = (WORD)((int)a.dwValue - 100); return 0;
}
}
//这是增大音量,按一下键盘就执行一次turnvolume函数
turnvolume(volume, 0);
mciSendCommand(wdd, MCI_SETAUDIO, MCI_DGV_SETAUDIO_VALUE | MCI_DGV_SETAUDIO_ITEM, (DWORD)&volume);

volume的dwvalue值我用prinft 输出过,值是没有问题的,无越界也是会改变的,但音量始终不变。
我的解答思路和尝试过的方法
我想要达到的结果

mixerSetControlDetails
The mixerSetControlDetails function sets properties of a single control associated with an audio line.

MMRESULT mixerSetControlDetails(
HMIXEROBJ hmxobj,
LPMIXERCONTROLDETAILS pmxcd,
DWORD fdwDetails
);

Parameters
hmxobj
Handle of the mixer device object for which properties are being set.
pmxcd
Address of a MIXERCONTROLDETAILS structure. This structure is used to reference control detail structures that contain the desired state for the control.
fdwDetails
Flags for setting properties for a control. The following values are defined:
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 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 a mixer device identifier 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.
MIXER_SETCONTROLDETAILSF_CUSTOM
A custom dialog box for the specified custom mixer control is displayed. The mixer device gathers the required information from the user and returns the data in the specified buffer. The handle for the owning window is specified in the hwndOwner member of the MIXERCONTROLDETAILS structure. (This handle can be set to NULL.) The application can then save the data from the dialog box and use it later to reset the control to the same state by using the MIXER_SETCONTROLDETAILSF_VALUE flag.
MIXER_SETCONTROLDETAILSF_VALUE
The current value(s) for a control are set. The paDetails member of the MIXERCONTROLDETAILS structure points to one or more mixer-control details structures of the appropriate class for the control.
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 mixerSetControlDetails.

If an application needs to retrieve only the current state of a custom mixer control and not display a dialog box, then mixerGetControlDetails can be used with the MIXER_GETCONTROLDETAILSF_VALUE flag.

QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.

See Also
Audio Mixers Overview, Audio Mixer Functions, MIXERCONTROLDETAILS, auxGetNumDevs, midiInOpen, midiOutOpen, mixerOpen, waveInOpen, waveOutOpen, midiInGetNumDevs, midiOutGetNumDevs, mixerGetNumDevs, waveInGetNumDevs, waveOutGetNumDevs, mixerGetControlDetails