El Guru Programador
Usuario DESCONOCIDO | Registrate Gratis | Usuarios Registrados
Foro de Visual Basic/VB.NET
Foros del Guru > Visual Basic/VB.NET
Usuario Como usar Mp3???
dano_Akd
5 Mensaje(s)
Enviado - 7/7/2004
 
Alguien sabe como poner un Mp3 en una aplicación de Visual?...bué...grax! de todas formas.
 
Zell
126 Mensaje(s)
Enviado - 7/7/2004
 
podes hacerlo usando un activex que cumpla dicho sentido.... eso lo tandrias que buscar en internet....

zell
 
Desconocido
Enviado - 5/10/2004
 
Ahí va un modulo escrito en VB.NET.
by Tamagochi

Module Repmp3
Class MP3rep
Private Declare Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA" _
(ByVal dwError As Integer, ByVal lpstrBuffer As String, ByVal uLength As Integer) As Integer
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" _
(ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Integer) As Integer
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _
ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer

Dim strArchivo As String
Dim strNombre As String
Dim strArchCorto As String

Sub New(Optional ByVal nombre As String = "RepMP3")
strNombre = nombre
End Sub
Public ReadOnly Property archivo() As String
Get
Return strArchivo
End Get
End Property
Public ReadOnly Property estado() As String
Get
Return Mensaje("status " & strNombre & " mode ")
End Get
End Property
Public Property volumen() As Integer
Get
Return CInt(Mensaje("status " & strNombre & " Volume"))
End Get
Set(ByVal Value As Integer)
Mensaje("setaudio " & strNombre & " Volume to " & CStr(Value))
End Set
End Property
Public Property velocidad() As Integer
Get
Return CInt(Mensaje("status " & strNombre & " speed"))
End Get
Set(ByVal Value As Integer)
Mensaje("set " & strNombre & " speed " & Value)
End Set

End Property
Public Property posicion() As Integer
Get
Dim i As Integer
i = CInt(Mensaje("status " & strNombre & " position"))
Return i
End Get
Set(ByVal Value As Integer)
Mensaje("seek " & strNombre & " to " & Value)
Reproducir()
End Set
End Property
Public ReadOnly Property tiempo() As Integer
Get
Mensaje("set " & strNombre & " time format ms")
Return CInt(Mensaje("status " & strNombre & " length"))
End Get
End Property
Public Sub cargar(ByVal archivo As String)
Dim lon As Integer

strArchCorto = Space(255)
strArchivo = archivo
lon = GetShortPathName(strArchivo, strArchCorto, 255)
strArchCorto = Left(strArchCorto, lon)
Mensaje("open " & strArchCorto & " type MPEGVideo Alias " & strNombre)

End Sub
Public Sub Reproducir()
Mensaje("play " & strNombre)
End Sub
Public Sub Parar()
Mensaje("stop " & strNombre)
End Sub
Public Sub Cerrar()
Mensaje("close " & strNombre)
End Sub


Public Function Mensaje(ByVal msg As String) As String
Dim ret As Integer
Dim cadena As String
Dim strERR As String

strERR = Space(128)
cadena = Space(128)
ret = mciSendString(msg, cadena, 128, 0)
If ret <> 0 Then
'lanzar mensage de error
mciGetErrorString(ret, strERR, 128)
MsgBox(strERR)
End If
Return cadena
End Function

End Class
End Module
 
 

 

Contactos myStudio Network