Visual Basic - sndplaysound

Life is soft - evento anual de software empresarial
 
Vista:
Imágen de perfil de FRANCISCO

sndplaysound

Publicado por FRANCISCO (52 intervenciones) el 09/05/2009 11:04:45
TENGO 5 BOTONES Y EN CADA UNO LE HE VARIADO LA CONSTANTE PARA QUE ME VARIE
EL MODO DE REPRODUCCION PERO EN TODOS LOS CASOS SE REPRODUCE DE LA
MISMA MANERA QUE HE HECHO MAL
GRACIAS




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

Const SND_ASYNC = &H1 ' play asynchronously
Const SND_SYNC = &H1
Const SND_NODEFAULT = &H1
Const SND_LOOP = &H1
Const SND_NOSTOP = &H1

Dim sonido As Integer

Private Sub Command3_Click()
sonido = sndPlaySound("shoot.wav", SND_ASYNC)
End Sub

Private Sub Command4_Click()
sonido = sndPlaySound("shoot.wav", SND_SYNC)
End Sub

Private Sub Command5_Click()
sonido = sndPlaySound("shoot.wav", SND_NODEFAULT)
End Sub

Private Sub Command6_Click()
sonido = sndPlaySound("shoot.wav", SND_LOOP)
End Sub

Private Sub Command7_Click()
sonido = sndPlaySound("shoot.wav", SND_NOSTOP)
End Sub
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:sndplaysound

Publicado por chicho (80 intervenciones) el 09/05/2009 19:38:06
El problema es que a todas las constantes le asignaste el mismo valor (&H1), entonces todas "se llaman diferente pero significan lo mismo", tenes que declararlas así:

Const SND_ASYNC = &H1 ' play asynchronously
Const SND_SYNC = &H0
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10

Con eso tendría que andar.

Suerte!

Chicho
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

RE:sndplaysound

Publicado por FRANCISCO  (2 intervenciones) el 09/05/2009 20:14:20
no va se bloquea el programa y la cpu va al 100%
gracias de todas formas

Paco...
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