PROBLEMAS COM MCI CONTROL

USUARIO.EXCLUIDOS 24/03/2004 21:23:39
#16895
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,
USUARIO.EXCLUIDOS 04/04/2004 11:01:41
#18770
Resposta escolhida
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
Tópico encerrado , respostas não são mais permitidas