PROBLEMAS COM MCI CONTROL
Estou usando o seguinte código:
MMControlSom.DeviceType = "WaveAudio"
MMControlSom.FileName = App.Path & "\som\som.wav"
MMControlSom.Command = "Open"
MMControlSom.Command = "Play"
MMControlSom.Command = "Close"
Só q toca a primeira vez e depois não toca +.
O q estou fazendo de errado ?
Abraços,
MMControlSom.DeviceType = "WaveAudio"
MMControlSom.FileName = App.Path & "\som\som.wav"
MMControlSom.Command = "Open"
MMControlSom.Command = "Play"
MMControlSom.Command = "Close"
Só q toca a primeira vez e depois não toca +.
O q estou fazendo de errado ?
Abraços,
voce precisa mesmo usar o mmcontrol?
existe uma forma de tocar arquivos via api que eh mto bom
'em um modulo
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Declare Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal uLength As Long) As Long
'toca arquivo TheSound
Public Sub PlaySound(ByVal FileName As String)
PrintMCIStatus mciSendString("open " & FileName & " type waveaudio alias TheSound wait", vbNullString, 0, 0)
PrintMCIStatus mciSendString("seek TheSound to start wait", vbNullString, 0, 0)
PrintMCIStatus mciSendString("play TheSound", vbNullString, 0, 0)
End Sub
'Stop
Public Sub StopPlaying
PrintMCIStatus mciSendString("stop TheSound", vbNullString, 0, 0)
end Sub
existe uma forma de tocar arquivos via api que eh mto bom
'em um modulo
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Declare Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal uLength As Long) As Long
'toca arquivo TheSound
Public Sub PlaySound(ByVal FileName As String)
PrintMCIStatus mciSendString("open " & FileName & " type waveaudio alias TheSound wait", vbNullString, 0, 0)
PrintMCIStatus mciSendString("seek TheSound to start wait", vbNullString, 0, 0)
PrintMCIStatus mciSendString("play TheSound", vbNullString, 0, 0)
End Sub
'Stop
Public Sub StopPlaying
PrintMCIStatus mciSendString("stop TheSound", vbNullString, 0, 0)
end Sub
Tópico encerrado , respostas não são mais permitidas