Visual Basic - Como hacer que se repita un sonido

Life is soft - evento anual de software empresarial
 
Vista:

Como hacer que se repita un sonido

Publicado por Danos (50 intervenciones) el 04/12/2005 01:27:24
TENGO ESTO EN EL CODIGO

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

(BOTON DE REPRODUCIR SONIDO)
'reproducir sonido
sndPlaySound "C:\nombre.wav", &H1

(BOTON DE DETENER SONIDO)
' detener el sonido
sndPlaySound vbNullString, 0

Y LO QUE QUIERO QUE HAGA ES QUE EL SONIDO SE REPRODUSCA HASTA DENENERLO CON EL BOTON DE DETENER EL SONIDO.

COMO LE HAGO? PENSE EN UTILIZAR UN FOR PERO NO SE COMO, SI ALGUIEN ME PUEDE AYUDAR SE LOS AGRADECERE.

SI PUEDEN PONER EL CODIGO SERIA DE MUCHISIMA AYUDA.

GRACIAS POR TODO
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Como hacer que se repita un sonido

Publicado por Ntx (22 intervenciones) el 05/12/2005 04:16:34
Yo utilice un timer y un check box para hacer mas o menos lo qhe necesitas. esta es parte de un programita que hice de un reloj despertador, por ahi te sirve. suertte

Private Sub Timtiempo_Timer()
On Error GoTo fin

Ahora = Format(Time, "hh:mm AMPM")
h = Int(Format(Time, "hh"))
m = Int(Format(Time, "mm"))
s = Int(Format(Time, "ss"))
Label2.Caption = Format(Time, "hh:mm:ss AMPM")
If Ahora = Cocoroco Then
Label3.Caption = "A levantarse Vago"
Reproduce = True
ReproduceWav (txtSoundFile)
Cocoroco = ""
End If

fin:
End Sub

Sub ReproduceWav(Sonido As String)
On Error GoTo FinError
Dim ret As Long
Dim Param As Long

'El programa sigue su ejecución luego de comenzada la
'reproducción del sonido
Param = SND_ASYNC + SND_NODEFAULT

'Si chequeo la opción Loop, el sonido se reproduce
'continuamente hasta un sndStopSound
If chkLoop.Value Then
Param = Param + SND_LOOP
End If

'Llamamos a la función
ret = sndPlaySound(Sonido, Param)
Exit Sub
FinError:
MuestraError
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar