Reproducir WAV

Iniciado por yeikos, 31 Mayo 2006, 00:38 AM

0 Miembros y 1 Visitante están viendo este tema.

yeikos

Este es el código


Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long
Private Sub Form_Load()
iResult = mciExecute("Play c:\carpeta 1\setup0.wav")
End Sub


El problema es que no reconoce la ruta porque encuentra un espacio, alguna solucion para arreglarlo? u otra manera de reproducir archivos wav?

Red Mx

si basicamente si quieres ejecutar esa pista




Option Explicit

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Const SW_NORMAL = 1
Private Sub Form_Load()
Dim X
   X = ShellExecute(Me.hwnd, "Open", "c:\carpeta 1\setup0.wav", &O0, &O0, SW_NORMAL)


End Sub




Saludos Red Mx!!!
Desarrollar Malware Es Causa De Cancer...

NYlOn

Intenta poniendo:

Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long
Private Sub Form_Load()
iResult = mciExecute("Play c:\carpeta~1\setup0.wav")
End Sub


Saludos.-

yeikos

#3
Ya encontré la solución buscando por el foro:


Public Const SND_APPLICATION = &H80         '  look for application specific association
Public Const SND_ALIAS = &H10000     '  name is a WIN.INI [sounds] entry
Public Const SND_ALIAS_ID = &H110000    '  name is a WIN.INI [sounds] entry identifier
Public Const SND_ASYNC = &H1         '  play asynchronously
Public Const SND_FILENAME = &H20000     '  name is a file name
Public Const SND_LOOP = &H8         '  loop the sound until next sndPlaySound
Public Const SND_MEMORY = &H4         '  lpszSoundName points to a memory file
Public Const SND_NODEFAULT = &H2         '  silence not default, if sound not found
Public Const SND_NOSTOP = &H10        '  don't stop any currently playing sound
Public Const SND_NOWAIT = &H2000      '  don't wait if the driver is busy
Public Const SND_PURGE = &H40               '  purge non-static events for task
Public Const SND_RESOURCE = &H40004     '  name is a resource name or atom
Public Const SND_SYNC = &H0         '  play synchronously (default)
Public Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

PlaySound "C:\carpeta 1\ding.wav", ByVal 0&, SND_FILENAME Or SND_ASYNC


Gracias de todas maneras ;)