Hi, Jerry, Thank you for the code. This code basically turns the volume of the system sounds, but what I really need to actually turn them off so that they never play. (As if the user had chosen "No sounds" in the control panel applet.) My problem is that the actual playing of the sounds is interfering with our software, especially when Legacy drivers are installed and KMixer is not present. -----Original Message----- From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@freelists. org] On Behalf Of jerry_wang Sent: Tuesday, April 20, 2004 7:31 PM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: Turn System Sounds On/Off hi, Sam Maybe I can help you. before tow years,i wrote the function as following: BOOL CompleteMuteFunction(BOOL bGetStatus,BOOL *pbStatus,BOOL bState) //bGetStatus : whether return the Mixer Status //pbStatus,if bGetStatus == TRUE,then return Mixer Status on the pointer //bState, if bState== TRUE,only return current Status, otherwise reset the Status { HMIXER Mutehmx; MMRESULT mmresult; MIXERCAPS mxcaps; MIXERLINE mxl; MIXERLINECONTROLS mxlc; MIXERCONTROL mxc; MIXERCONTROLDETAILS mxcd; MIXERCONTROLDETAILS_BOOLEAN mxcdb; mmresult = mixerOpen(&Mutehmx,0,(DWORD)hWndMain,0,MIXER_OBJECTF_MIXER); if (MMSYSERR_NOERROR != mmresult) { mixerClose(Mutehmx); return FALSE; } mmresult = mixerGetDevCaps(0,&mxcaps,sizeof(MIXERCAPS)); if (MMSYSERR_NOERROR != mmresult) { mixerClose(Mutehmx); return FALSE; } memset((LPVOID)(&mxl),0,sizeof(MIXERLINE)); mxl.cbStruct = sizeof(MIXERLINE); mxl.dwDestination = 0; mmresult = mixerGetLineInfo((HMIXEROBJ)Mutehmx,&mxl,MIXER_GETLINEINFOF_DESTINATION); if (MMSYSERR_NOERROR != mmresult) { mixerClose(Mutehmx); return FALSE; } mxlc.cbStruct = sizeof(MIXERLINECONTROLS); mxlc.dwLineID = mxl.dwLineID; mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_MUTE; mxlc.cControls = mxl.cControls; mxlc.cbmxctrl = sizeof (MIXERCONTROL); mxlc.pamxctrl = &mxc; mmresult = mixerGetLineControls((HMIXEROBJ)Mutehmx, &mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE); if (MMSYSERR_NOERROR != mmresult) { mixerClose(Mutehmx); return FALSE; } mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS); mxcd.dwControlID = mxc.dwControlID; mxcd.cChannels = 1; mxcd.cMultipleItems = mxc.cMultipleItems; mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN); mxcd.paDetails = &mxcdb; mmresult = mixerGetControlDetails((HMIXEROBJ)Mutehmx,&mxcd,MIXER_GETCONTROLDETAILSF_VAL UE); if (MMSYSERR_NOERROR != mmresult) { mixerClose(Mutehmx); Mutehmx=NULL; return FALSE; } if(bState==TRUE) { *pbStatus=!mxcdb.fValue; mixerClose(Mutehmx); Mutehmx=NULL; } else { if(pbStatus!=NULL) //得到Mute状态,pbStatus用于控制 { *pbStatus=mxcdb.fValue; } if(bGetStatus) { mixerClose(Mutehmx); Mutehmx=NULL; return TRUE; } mxcdb.fValue = !mxcdb.fValue; mmresult = mixerSetControlDetails((HMIXEROBJ)Mutehmx,&mxcd,MIXER_GETCONTROLDETAILSF_VAL UE); mixerClose(Mutehmx); Mutehmx=NULL; if(pbStatus!=NULL) *pbStatus=!(*pbStatus); } return TRUE; } and another function as following: BOOL ControlVolume(int nVolume,BOOL bGetVolume,DWORD *pdwCurrentVolume) //nVolume,inc or dec Volume( 1 or -1 ) //bGetVolume,whether return the volume //if bGetVolume == TRUE, return volume on the pointer { UINT mixerID = 0,nUnit; MMRESULT mmresult; HMIXER Mutehmx; MIXERCAPS mxcaps; MIXERLINE mxl; MIXERLINECONTROLS mxlc; MIXERCONTROL mxc; MIXERCONTROLDETAILS mxcd; MIXERCONTROLDETAILS_UNSIGNED mxcdu; mmresult = mixerOpen(&Mutehmx,mixerID,0,0,MIXER_OBJECTF_MIXER); if (MMSYSERR_NOERROR != mmresult) { mixerClose(Mutehmx); return FALSE; } mmresult = mixerGetDevCaps(mixerID,&mxcaps,sizeof(MIXERCAPS)); if (MMSYSERR_NOERROR != mmresult) { mixerClose(Mutehmx); return FALSE; } mxl.cbStruct = sizeof(MIXERLINE); mxl.dwDestination = 0;//only get the first mxl.dwSource = 0; // mxl.dwComponentType=MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT; mmresult = mixerGetLineInfo((HMIXEROBJ)Mutehmx,&mxl,MIXER_GETLINEINFOF_DESTINATION);//M IXER_GETLINEINFOF_COMPONENTTYPE if (MMSYSERR_NOERROR != mmresult) { mixerClose(Mutehmx); return FALSE; } mxlc.cbStruct = sizeof(MIXERLINECONTROLS); mxlc.dwLineID = mxl.dwLineID; mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME; mxlc.cControls = mxl.cControls; mxlc.cbmxctrl = sizeof (MIXERCONTROL); mxlc.pamxctrl = &mxc; mmresult = mixerGetLineControls((HMIXEROBJ)Mutehmx, &mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE); if (MMSYSERR_NOERROR != mmresult) { mixerClose(Mutehmx); return FALSE; } //get volume mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS); mxcd.dwControlID = mxc.dwControlID; mxcd.cChannels = 1; mxcd.cMultipleItems = mxc.cMultipleItems; mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED); mxcd.paDetails = &mxcdu; mmresult = mixerGetControlDetails((HMIXEROBJ)Mutehmx,&mxcd,MIXER_GETCONTROLDETAILSF_VAL UE); if (MMSYSERR_NOERROR != mmresult) { mixerClose(Mutehmx); return FALSE; } //now set volume DWORD dwMin = mxc.Bounds.dwMinimum; DWORD dwMax = mxc.Bounds.dwMaximum; nUnit=(dwMax-dwMin)/MAX_VOLUME; if(bGetVolume) { mixerClose(Mutehmx); if(pdwCurrentVolume!=NULL) *pdwCurrentVolume=mxcdu.dwValue/nUnit; return TRUE; } if(nVolume==0) mxcdu.dwValue =dwMin; else { nVolume=(INT)(nUnit*nVolume); mxcdu.dwValue +=nVolume; if(mxcdu.dwValue>dwMax) if(nVolume<0) mxcdu.dwValue = dwMin; else mxcdu.dwValue=dwMax; } if(pdwCurrentVolume!=NULL) *pdwCurrentVolume=mxcdu.dwValue/nUnit; mmresult = mixerSetControlDetails((HMIXEROBJ)Mutehmx,&mxcd,MIXER_GETCONTROLDETAILSF_VAL UE); mixerClose(Mutehmx); return TRUE; } I hope that these code can help you . Jerry from beijing of P.R.China 2004.4.21 ----- Original Message ----- From: "Sam Tertzakian" <thatsamiam@xxxxxxxxxxx> To: <wdmaudiodev@xxxxxxxxxxxxx> Sent: Monday, April 19, 2004 8:29 PM Subject: [wdmaudiodev] Turn System Sounds On/Off > Hi, > > I need to write a routine that runs in user mode that allows me to turn > System Sounds on or off in 98SE, 2000 and XP. Does anybody know the best > way to do this? > > Thank you for your suggestions. > > _________________________________________________________________ > Watch LIVE baseball games on your computer with MLB.TV, included with MSN > Premium! > http://join.msn.com/?page=features/mlb&pgmarket=en-us/go/onm00200439ave/dire ct/01/ > > ****************** > > WDMAUDIODEV addresses: > Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx > Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe > Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe > Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx > > URL to WDMAUDIODEV page: > http://www.wdmaudiodev.de/ > ****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.de/ ****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.de/