elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  [APORTE]Reproductor de Video/Audio
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [APORTE]Reproductor de Video/Audio  (Leído 1,949 veces)
ShadowHoc

Desconectado Desconectado

Mensajes: 8



Ver Perfil
[APORTE]Reproductor de Video/Audio
« en: 24 Julio 2013, 06:07 am »

Wholas vengo a dejar un repdoductor de Audio/video porque estaba aburrido y no tenia nada que hacer  :P :P :P

7Botones
1 Common Dialog
3 Timers
1 Slider
1 label

----------------------Vamos al Codigo ;D------------------------------------------------------

Código:
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias _
    "mciSendStringA" (ByVal lpstrCommand As String, ByVal _
    lpstrReturnString As Any, ByVal uReturnLength As Long, ByVal _
    hwndCallback As Long) As Long

Private Declare Function GetShortPathName Lib "kernel32" _
      Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
      ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
'*** Constantes ***
Private Const OFN_FILEMUSTEXIST = &H1000&
Private Const OFN_READONLY = &H4&

'*** Variables ***
Private DialogCaption As String
Private FileName As String
Private Const MODAL = 1
Private Const MODELESS = 2

Dim i As Long
Dim ShortName
Dim mssg As String * 255
Dim ResumeStat As String
Dim FFRR As String


   Public Function GetShortName(ByVal sLongFileName As String) As String
       Dim lRetVal As Long, sShortPathName As String, iLen As Integer
     
       sShortPathName = Space(255)
       iLen = Len(sShortPathName)

     
       lRetVal = GetShortPathName(sLongFileName, sShortPathName, iLen)
       
       GetShortName = Left(sShortPathName, lRetVal)
   End Function
Private Sub Command1_Click()
  Dim MInfo As String
Screen.MousePointer = 11

CommonDialog1.CancelError = True
On Error GoTo EH1

CommonDialog1.Filter = "Archivos de Video|*.wmv;*.mpa;*.mpe;*.mpg;*.mpeg;*.avi|Windows Media Video|*.wmv|Archivo de Pelicula(mpeg)|*.mpg;*.mpa;*.mpe;*.mpeg|Video para Windows|*.avi|Todos los ficheros (*.*)|*.*"
CommonDialog1.Flags = OFN_FILEMUSTEXIST Or OFN_READONLY

CommonDialog1.ShowOpen

 ShortName = GetShortName(CommonDialog1.FileName)

i = mciSendString("close all", 0&, 0, 0)

Get_Size GetShortName(CommonDialog1.FileName)



Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Screen.MousePointer = 0
Me.Caption = "Reproductor de Video - " + CommonDialog1.FileTitle
App.Title = "Reproductor de Video - " + CommonDialog1.FileTitle
Exit Sub

EH1:

Screen.MousePointer = 0
If Err = 32755 Then Err.Clear: Exit Sub
MsgBox Err.Description, vbExclamation, "ERR #" & Err
End Sub

Private Sub Command2_Click()
 i = mciSendString("play video1 from " & Slider1.Value, 0&, 0, 0)
End Sub


Private Sub Command3_Click()
 i = mciSendString("pause video1", 0&, 0, 0)
End Sub


Private Sub Command4_Click()
 i = mciSendString("stop video1", 0&, 0, 0)
 i = mciSendString("seek video1 to start", 0&, 0, 0)
 Slider1.Value = 0
End Sub



Private Sub Command5_Click()
 i = mciSendString("resume video1", 0&, 0, 0)
End Sub

Private Sub Command6_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = mciSendString("set video1 audio all off", mssg, 255, 0)
i = mciSendString("status video1 mode", mssg, 255, 0)
FFRR = mssg
Timer2.Enabled = True

End Sub


Private Sub Command6_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = mciSendString("set video1 audio all on", mssg, 255, 0)
Timer2.Enabled = False

Select Case Left$(FFRR, 4)
Case "stop"
 i = mciSendString("stop video1", 0&, 0, 0)
Case "play"
 i = mciSendString("play video1", 0&, 0, 0)
Case "paus"
 i = mciSendString("pause video1", 0&, 0, 0)
Case Else
End Select


End Sub


Private Sub Command7_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = mciSendString("set video1 audio all off", mssg, 255, 0)
i = mciSendString("status video1 mode", mssg, 255, 0)
FFRR = mssg
Timer3.Enabled = True

End Sub


Private Sub Command7_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = mciSendString("set video1 audio all on", mssg, 255, 0)
Timer3.Enabled = False

Select Case Left$(FFRR, 4)
Case "stop"
 i = mciSendString("stop video1", 0&, 0, 0)
Case "play"
 i = mciSendString("play video1", 0&, 0, 0)
Case "paus"
 i = mciSendString("pause video1", 0&, 0, 0)
Case Else
End Select

End Sub




Private Sub Form_Unload(Cancel As Integer)
 i = mciSendString("close video1", 0&, 0, 0)


End Sub



Public Function Get_Size(ShortName As String)
Dim sReturn As String * 128
Dim lPos As Long
Dim lStart As Long
Dim Last$, Todo$, lWidth, lHeight

   
Last$ = Form1.hWnd & " Style " & &H40000000
Todo$ = "open " & ShortName & " Alias video1 parent " & Last$
i = mciSendString(Todo$, 0&, 0, 0)

i = mciSendString("Where video1 destination", ByVal sReturn, Len(sReturn) - 1, 0)
   
lStart = InStr(1, sReturn, " ")
lPos = InStr(lStart + 1, sReturn, " ")
lStart = InStr(lPos + 1, sReturn, " ")
lWidth = Mid(sReturn, lPos, lStart - lPos)
lHeight = Mid(sReturn, lStart + 1)
   
   
i = mciSendString("put video1 window at 8 80 " & lWidth & " " & lHeight, 0&, 0, 0)


i = mciSendString("set video1 time format ms", 0&, 0, 0)
i = mciSendString("status video1 length", mssg, 255, 0)


Slider1.Max = Val(mssg)

 Timer1.Enabled = True
End Function

Private Sub Label1_Click()

End Sub

Private Sub Slider1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Timer1.Enabled = False
i = mciSendString("status video1 mode", mssg, 255, 0)

If Left$(mssg, 7) = "playing" Then
  ResumeStat = "playing"
Else
  ResumeStat = ""
End If

i = mciSendString("pause video1", 0&, 0, 0)
End Sub


Private Sub Slider1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
 
 i = mciSendString("seek video1 to " & Slider1.Value, 0&, 0, 0)

If ResumeStat = "playing" Then
  i = mciSendString("play video1", 0&, 0, 0)
End If
 
   
  Timer1.Enabled = True
   
End Sub


Private Sub Timer1_Timer()
On Error Resume Next
Dim VidPos As String
Dim SegunI, MinutosI, SegundosI, LTrackPosition
i = mciSendString("status video1 position", mssg, 255, 0)
VidPos = Str(mssg)

Slider1.Value = VidPos
LTrackPosition = mssg
SegunI = Val(LTrackPosition) \ 1000
MinutosI = SegunI \ 60
SegundosI = SegunI Mod 60
Label1.Caption = MinutosI & " min. " & SegundosI & " seg."
If Err Then Exit Sub

End Sub


Private Sub Timer2_Timer()
On Error Resume Next
 i = mciSendString("stop video1", 0&, 0, 0)
 i = mciSendString("status video1 position", mssg, 255, 0)
 
 If mssg + 50 > Slider1.Max Then
     i = mciSendString("seek video1 to end", 0&, 0, 0)
 Else
    i = mciSendString("play video1 from " & mssg + 50, 0&, 0, 0)
 End If
End Sub

Private Sub Timer3_Timer()
On Error Resume Next
 i = mciSendString("stop video1", 0&, 0, 0)
 i = mciSendString("status video1 position", mssg, 255, 0)
 
 If mssg - 50 <= 0 Then
    i = mciSendString("seek video1 to start", 0&, 0, 0)
    Slider1.Value = 0
 Else
    i = mciSendString("play video1 from " & mssg - 50, 0&, 0, 0)
 End If

End Sub

-----------------
Bueno espero que les sirva de algo xD


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
como instalar reproductor de video y audio en wifiway/backtrack/wifislax?¿? « 1 2 »
Wireless en Linux
beholdthe 10 22,270 Último mensaje 11 Febrero 2011, 21:00 pm
por DameBanda
[MOD] que reproductor de audio y video me recomendais?
Multimedia
pepelu740 3 5,191 Último mensaje 4 Febrero 2010, 18:06 pm
por Songoku
jetAudio 8.0.7: nueva versión del reproductor multimedia de audio y vídeo
Software
wolfbcn 0 1,840 Último mensaje 9 Julio 2010, 21:19 pm
por wolfbcn
[Aporte] Reproductor MP3 en Java-NetBeans
Java
samirllorente 2 4,102 Último mensaje 17 Febrero 2015, 17:00 pm
por MNicolas
Reproductor web de audio en flash
Multimedia
r32 0 2,448 Último mensaje 11 Mayo 2019, 16:00 pm
por r32
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines