PROGRAMA MUSICA
Como faço pra quando abrir o programa, uma musica rodar junto ?
"tipo eu abro o programa, e começa a toka uma musika ."
"tipo eu abro o programa, e começa a toka uma musika ."
hehe...
acabei de vê isso, pena que não era o que eu queria:
Esse exemplo toca musica, grava e fecha o arquivo
Option Explicit
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
'retorna erro de retorno de STATUS
'inicia bufferizacao - hwnd de form
'toca arquivo Temp - c:\windows\desktop\arquivo.mp3 ou c:\windows\desktop\arquivo.wav
'grava arquivo>>> C:\windows\desktop\arquivo.wav
'Encerrar Arquivo sem gravar (e para caso de play)
acabei de vê isso, pena que não era o que eu queria:
Esse exemplo toca musica, grava e fecha o arquivo
Option Explicit
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
'retorna erro de retorno de STATUS
Private Sub PrintMCIStatus(Code As Long)
Dim ErrorMsg As String
ErrorMsg = String$(1024, vbNullChar) 'buffer para armazenar erro
mciGetErrorString Code, ErrorMsg, 1024 ' pega erro
ErrorMsg = Left(ErrorMsg, InStr(1, ErrorMsg, vbNullChar) - 1) 'limpa vazios
Debug.Print ErrorMsg
End Sub
'inicia bufferizacao - hwnd de form
Public Sub Record(ByVal hwnd As Long)
PrintMCIStatus mciSendString("open new type waveaudio alias Temp wait", vbNullString, 0, 0)
PrintMCIStatus mciSendString("seek Temp to start wait", vbNullString, 0, 0)
PrintMCIStatus mciSendString("record Temp overwrite notify", vbNullString, 0, hwnd)
End Sub
'toca arquivo Temp - c:\windows\desktop\arquivo.mp3 ou c:\windows\desktop\arquivo.wav
Public Sub PlaySound(ByVal FileName As String)
On Error Resume Next
PrintMCIStatus mciSendString("open """ & FileName & """ alias Temp wait", vbNullString, 0, 0)
PrintMCIStatus mciSendString("seek Temp to start wait", vbNullString, 0, 0)
PrintMCIStatus mciSendString("play Temp", vbNullString, 0, 0)
End Sub
'grava arquivo>>> C:\windows\desktop\arquivo.wav
Public Sub StopSaveRecord(ByVal Arquivo As String)
PrintMCIStatus mciSendString("stop Temp", vbNullString, 0, 0)
PrintMCIStatus mciSendString("save Temp """ & Arquivo & """", vbNullString, 0, 0)
PrintMCIStatus mciSendString("close Temp", vbNullString, 0, 0)
End Sub
'Encerrar Arquivo sem gravar (e para caso de play)
Public Sub EncerrarArquivo()
PrintMCIStatus mciSendString("close Temp", vbNullString, 0, 0)
End Sub
Tópico encerrado , respostas não são mais permitidas