← Foro de Tecnologías .NET

Sonido en Visual Basic .NET

Hilo en el foro de Tecnologías .NET · 03 de Junio del 2005 · 1 respuestas
IsabelHH03 de Junio del 2005
Pregunta
Hola, estoy haciendo un juego en VB.Net y me gustaria ponerle musiquilla, pero no tengo ni idea de como puedo hacerlo. Tiene alguien una idea???
Gracias

Respuestas 1

barnum03 de Junio del 2005
aquie tienes el ejemplo que da la ayuda espero que te sirva de algo,

Public Class SoundClass
Declare Auto Function PlaySound Lib "winmm.dll" (ByVal name _
As String, ByVal hmod As Integer, ByVal flags As Integer) As Integer
' name specifies the sound file when the SND_FILENAME flag is set.
' hmod specifies an executable file handle.
' hmod must be Nothing if the SND_RESOURCE flag is not set.
' flags specifies which flags are set.

' The PlaySound documentation lists all valid flags.
Public Const SND_SYNC = &H0 ' play synchronously
Public Const SND_ASYNC = &H1 ' play asynchronously
Public Const SND_FILENAME = &H20000 ' name is file name
Public Const SND_RESOURCE = &H40004 ' name is resource name or atom

Public Sub PlaySoundFile(ByVal filename As String)
' Plays a sound from filename.
PlaySound(filename, Nothing, SND_FILENAME Or SND_ASYNC)
End Sub
End Class

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim SoundInst As New SoundClass()
SoundInst.PlaySoundFile("C:ringout.wav")
End Sub
¿Buscas más hilos como este? Mira el foro de Tecnologías .NET o usa el buscador.