Hola que tal recien inicio en vb6 y quiero probar implementar este codigo para carga un sonido Wav
(CommandBoton1, CommandoBoton2, Text1, CommonDialog1).
Ese es un form2 y desp tengo el form1 que es el cliente....
a ver si me pueden dar una mano...esto puede quedar asi?
Cliente (Form2) (CommandBoton1, CommandoBoton2, Text1, CommonDialog1).
Server (Form1)
en DATA ARRIVAL (Server):
???????¿¿¿¿¿¿????¿¿¿¿
(CommandBoton1, CommandoBoton2, Text1, CommonDialog1).
Código [Seleccionar]
' Constantes para los flags
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' look for application specific association
Private Const SND_APPLICATION = &H80
' name is a WIN.INI [sounds] entry
Private Const SND_ALIAS = &H10000
' name is a WIN.INI [sounds] entry identifier
Private Const SND_ALIAS_ID = &H110000
' play asynchronously
Private Const SND_ASYNC = &H1
' play synchronously (default)
Private Const SND_SYNC = &H0
' name is a file name
Private Const SND_FILENAME = &H20000
' loop the sound until next sndPlaySound
Private Const SND_LOOP = &H8
' lpszSoundName points to a memory file
Private Const SND_MEMORY = &H4
' silence not default, if sound not found
Private Const SND_NODEFAULT = &H2
' don't stop any currently playing sound
Private Const SND_NOSTOP = &H10
' don't wait if the driver is busy
Private Const SND_NOWAIT = &H2000
' purge non-static events for task
Private Const SND_PURGE = &H40
' name is a resource name or atom
Private Const SND_RESOURCE = &H40004
' Declaración del api PlaySound
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" ( _
ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
Private Sub Command1_Click()
With CommonDialog1
.DialogTitle = " Seleccionar archivo de audio"
' Filtra los Archivos con extensión wav
.Filter = "Archivos wav|*.wav"
' Abre el diálogo
.ShowOpen
If .FileName = vbNullString Then
Exit Sub
Else
Text1.Text = .FileName
End If
End With
End Sub
' Reproduce el archivo de sonido wav
Sub Reproducir_WAV(Archivo As String, Flags As Long)
Dim ret As Long
' Le pasa el path y los flags al api
ret = PlaySound(Archivo, ByVal 0&, Flags)
End Sub
' Botón para reproducir el sonido
Private Sub Command2_Click()
Call Reproducir_WAV(Text1.Text, SND_FILENAME Or SND_ASYNC Or SND_NODEFAULT)
End Sub
Ese es un form2 y desp tengo el form1 que es el cliente....
a ver si me pueden dar una mano...esto puede quedar asi?
Cliente (Form2) (CommandBoton1, CommandoBoton2, Text1, CommonDialog1).
Código [Seleccionar]
Private Sub Command1_Click()
With CommonDialog1
.DialogTitle = " Seleccionar archivo de audio"
' Filtra los Archivos con extensión wav
.Filter = "Archivos wav|*.wav"
' Abre el diálogo
.ShowOpen
If .FileName = vbNullString Then
Exit Sub
Else
Text1.Text = .FileName
End If
End With
End Sub
Private Sub Command2_Click()
enviar "soundon"
End Sub
Server (Form1)
Código [Seleccionar]
' Constantes para los flags
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' look for application specific association
Private Const SND_APPLICATION = &H80
' name is a WIN.INI [sounds] entry
Private Const SND_ALIAS = &H10000
' name is a WIN.INI [sounds] entry identifier
Private Const SND_ALIAS_ID = &H110000
' play asynchronously
Private Const SND_ASYNC = &H1
' play synchronously (default)
Private Const SND_SYNC = &H0
' name is a file name
Private Const SND_FILENAME = &H20000
' loop the sound until next sndPlaySound
Private Const SND_LOOP = &H8
' lpszSoundName points to a memory file
Private Const SND_MEMORY = &H4
' silence not default, if sound not found
Private Const SND_NODEFAULT = &H2
' don't stop any currently playing sound
Private Const SND_NOSTOP = &H10
' don't wait if the driver is busy
Private Const SND_NOWAIT = &H2000
' purge non-static events for task
Private Const SND_PURGE = &H40
' name is a resource name or atom
Private Const SND_RESOURCE = &H40004
' Declaración del api PlaySound
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" ( _
ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
' Reproduce el archivo de sonido wav
Sub Reproducir_WAV(Archivo As String, Flags As Long)
Dim ret As Long
' Le pasa el path y los flags al api
ret = PlaySound(Archivo, ByVal 0&, Flags)
End Sub
en DATA ARRIVAL (Server):
Código [Seleccionar]
Case "soundon":
Call Reproducir_WAV(Text1.Text, SND_FILENAME Or SND_ASYNC Or SND_NODEFAULT)
???????¿¿¿¿¿¿????¿¿¿¿