PDA

View Full Version : Solved: Mute Function



Nazim
08-27-2006, 09:01 AM
Is it at all possible to activate the mute button from an Access Form, using a module. This is because i have a flash video that plays on my main menu, and the music that the video plays continues non stop. I have tried experimenting with the clip's loop function with little success. Therefore the only option i have left is to have a mute button on the main menu as well. (This database is part of a school project) Any help you can provide will be greatly appreciated. Thanks.:think:

ALe
08-28-2006, 01:57 AM
It can be done by API. Check microsoft site. I remember there was something about it.

Look at this link for an example (I haven't tested it)
http://66.102.9.104/search?q=cache:nThuiFaxgusJ:www.ex-designz.net/apidetail.asp%3Fapi_id%3D534+vba+declare+function+audio+volume&hl=en&gl=it&ct=clnk&cd=28

Nazim
08-28-2006, 04:04 AM
Thank you. The above link you provided was just what i needed. i :thumb

Nazim
08-28-2006, 04:43 AM
i have the following code,

Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer


Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer

Private Sub Check1_Click()
Dim RetVal As Long
Static Volume As Long
If Check1.Value Then
' Store last volume level to 'Volume'
RetVal = waveOutGetVolume(ByVal 0, Volume)
' Mute
RetVal = waveOutSetVolume(ByVal 0, 0)
Else
' Retrieve last volume level
RetVal = waveOutSetVolume(ByVal 0, Volume)
End If
End Sub

My problem now is that the above code is for a Check box (Check1) to activate the mute fuction. Can anyone help me to adapt the above code for a command button instead??? Thanks for any help you guys can provide.

ALe
08-28-2006, 04:50 AM
Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer

Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer
Private Sub CommandButton1_Click()
Dim RetVal As Long
Static Volume As Long
If Check1.Value Then
' Store last volume level to 'Volume'
RetVal = waveOutGetVolume(ByVal 0, Volume)
' Mute
RetVal = waveOutSetVolume(ByVal 0, 0)
Else
' Retrieve last volume level
RetVal = waveOutSetVolume(ByVal 0, Volume)
End If
End Sub

ALe
08-28-2006, 04:52 AM
Sorry, last code wasn't good.
Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer

Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer
Private Sub CommandButton1_Click()
Dim RetVal As Long
Static Volume As Long
' Mute
RetVal = waveOutSetVolume(ByVal 0, 0)
' Retrieve last volume level
'RetVal = waveOutSetVolume(ByVal 0, Volume)
End If
End Sub

ALe
08-28-2006, 04:53 AM
Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer

Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer
Private Sub CommandButton1_Click()
Dim RetVal As Long
Static Volume As Long
' Mute
RetVal = waveOutSetVolume(ByVal 0, 0)
' Retrieve last volume level
'RetVal = waveOutSetVolume(ByVal 0, Volume)
End Sub

Nazim
08-28-2006, 04:59 AM
ok

ALe
08-28-2006, 05:05 AM
if it's working, don't forget to mark this thread as solved

Nazim
08-28-2006, 05:33 AM
Sure will

ALe
08-28-2006, 05:53 AM
Sub GetVolumeBack()
Dim RetVal As Long
RetVal = waveOutSetVolume(ByVal 0, 50000)
End Sub

Nazim
08-28-2006, 06:03 AM
Well the check box works and is fine, i will settle with that. Thats it guys thanks for your help, i have a code so problem solved. Also thanks to ALe for giving me the link http://66.102.9.104/search?q=cache:nThuiFaxgusJ:www.ex-designz.net/apidetail.asp%3Fapi_id%3D534+vba+declare+function+audio+volume&hl=en&gl=it& ct=clnk&cd=28
as it enabled me to come up with the check box code for muting.