TActiveX() (play a video or sound)

TActiveX() (play a video or sound)

Postby acuellar » Fri Jun 14, 2013 6:22 pm

TActiveX() no Funciona en FWH 12.12 Alguien sabe porque

oActiveX = TActiveX():New( oDlg,"MediaPlayer.MediaPlayer.1",oDlg:nTop, oDlg:nLeft, oDlg:nRight, oDlg:nBottom )
Sale este error: Can't read from type ActiveX

Existe otra manera de mostrar videos.

Gracias

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1594
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: TActiveX()

Postby Antonio Linares » Fri Jun 14, 2013 8:23 pm

Adhemar,

Prueba con este código:

Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oWnd, oActiveX

   DEFINE WINDOW oWnd TITLE "FiveWin ActiveX Support"

   oActiveX = TActiveX():New( oWnd, "WMPlayer.OCX" )

   oWnd:oClient = oActiveX // To fill the entire window surface

   oActiveX:url = "clapping.wav"

   ACTIVATE WINDOW oWnd

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TActiveX()

Postby acuellar » Sun Jun 16, 2013 10:43 am

Gracias Antonio,
Funciona

Este es mi código:
Code: Select all  Expand view

Function PlayVideo()
   Private oDlg, oActiveX,aCoors:=GetCoors( FindWindow("Shell_TrayWnd","") )
   VideoPath:=AllTrim(UBICACION)+AllTrim(NOMBRE)+'.'+EXT
   
   If !File(VideoPath)
     MsgAlert("No existe el video","Lo siento")
     Return
   Endif
 
   DEFINE DIALOG oDlg TITLE UPPER(NOMBRE) FROM -7,1 TO aCoors[1]-11, aCoors[4] PIXEL;oDlg:lHelpIcon := .F.
    oActiveX = TActiveX():New( oDlg,"WMPlayer.OCX" )
   ACTIVATE DIALOG oDlg CENTER ON INIT MuestraVIDEO()
   oDlg:End()

Return NIL
*
STATIC Function MuestraVIDEO()
 
  oDlg:oClient = oActiveX
  oActiveX:url = VideoPath

Return Nil

 

Cómo hacer para que se muestre en toda la pantalla?
Cómo hacer que se cierre el dialogo al finalizar el video?
Cómo controlar el balance del audio?
Que muestre la duración?
Al cerrar el dialogo se sigue reproduciendo. Como finalizarlo oActiveX:Stop() no funciona.

Gracias distinguido.

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1594
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: TActiveX()

Postby Antonio Linares » Sun Jun 16, 2013 4:07 pm

Adhemar,

Nota: X: en el código es X: (es que no aparece bien)

Prueba asi:

Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg TITLE "FiveWin ActiveX Support"

   ACTIVATE DIALOG oDlg ;
      ON INIT BuildMPlayer( oDlg )

return nil

function BuildMPlayer( oDlg )

   local oActiveX

   oActiveX = TActiveX():New( oDlg, "WMPlayer.OCX" )

   oDlg:oClient = oActiveX // To fill the entire window surface

   oActiveX:Settings:Volume = 7

   oActiveX:url = "clapping.wav"
   oActiveX:EnableContextMenu()
   
   oDlg:Maximize()
   
   while oActiveX:Playstate != 1
      SysRefresh()
   end
   
   oDlg:End()

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TActiveX()

Postby acuellar » Mon Jun 17, 2013 1:40 pm

Gracias Antonio

Cuando termina de reproducirse el video se cierra perfecto.
pero cuando cierro el dialogo el video sigue reproduciéndose.

Muchas gracias.

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1594
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: TActiveX()

Postby Antonio Linares » Mon Jun 17, 2013 2:17 pm

Adhemar,

Si, lo he observado tambien. No se si algun evento pueda ayudarnos.

Primero intenté con eventos pero no encontré un patrón que pudiese ser el fin de reproducción y al final encontré la otra forma de hacerlo sin eventos.

Y la documentación de Microsoft y ejemplos que encontré no ayudaron lo suficiente. Pero bueno, algo es algo, igual encontramos la forma más adelante :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TActiveX()

Postby acuellar » Mon Jun 17, 2013 2:35 pm

Gracias Antonio


Estaré aguardando.

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1594
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: TActiveX()

Postby Antonio Linares » Mon Jun 17, 2013 3:11 pm

Creo que esto puede servir: :-)

en el VALID del diálogo podemos hacer:

oActiveX:controls:Stop() y luego devolver .T.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TActiveX()

Postby acuellar » Mon Jun 17, 2013 3:30 pm

Gracias Antonio

Funciona perfecto.

Cómo hacer que el video se inicie maximizado?

De donde se puede conseguir información sobre mas controles.

Gracias por tu tiempo.

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1594
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: TActiveX()

Postby Antonio Linares » Mon Jun 17, 2013 3:58 pm

Adhemar,

El diálogo se muestra maximizado ? oDlg:Maximize() desde ON INIT. Si has hecho oDlg:oClient := oActiveX se ajustará automaticamente.

Toda la información necesaria para proporcionarte este ejemplo la he conseguido en google, simplemente buscando :-)

Busca por el nombre del ActiveX y revisa los ejemplos que te aparezcan, aunque esten en otros lenguajes. Te servirán para ver todo lo que se puede hacer con él :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TActiveX()

Postby acuellar » Mon Jun 17, 2013 5:16 pm

Antonio

Efectivamente el dialogo aparece maximizado, el video no, hay que dar doble click para que maximice en toda la pantalla.

Cómo dar doble click?

Gracias distinguido.

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1594
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: TActiveX()

Postby Antonio Linares » Mon Jun 17, 2013 8:26 pm

Aqui lo tienes:

Code: Select all  Expand view
#include "FiveWin.ch"

static oActiveX

function Main()

   local oDlg

   DEFINE DIALOG oDlg TITLE "FiveWin ActiveX Support"

   ACTIVATE DIALOG oDlg ;
      ON INIT BuildMPlayer( oDlg ) ;
      VALID ( oActiveX:controls:Stop(), .T. )

return nil

function BuildMPlayer( oDlg )

   oActiveX = TActiveX():New( oDlg, "WMPlayer.OCX" )

   oDlg:oClient = oActiveX // To fill the entire window surface

   oActiveX:Settings:Volume = 7

   oDlg:Maximize()

   oActiveX:url = "fivewin.avi"
   oActiveX:StretchToFit = .T.
   oActiveX:EnableContextMenu()
   
   while oActiveX:Playstate != 1
      SysRefresh()
   end
   
   oDlg:End()

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TActiveX()

Postby Antonio Linares » Mon Jun 17, 2013 9:08 pm

En su dia inspeccioné ese objeto y esta es la lista de propiedades y metodos que obtuve:

viewtopic.php?p=144616#p144616
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TActiveX()

Postby acuellar » Tue Jun 18, 2013 1:03 pm

Perfecto.

Gracias Distinguido.

Cómo obtener la duración del video, como la muestra el explorador de Windows para cargar los videos a una base.
Uso el comando DIR desde DOS
DIR C:\VIDEOS\*.AVI /S/-C >>VIDEOS.TXT //No muestra la duración.

Gracias por tu tiempo y ayuda.


Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1594
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: TActiveX()

Postby Antonio Linares » Tue Jun 18, 2013 6:46 pm

Añade esta linea:

Code: Select all  Expand view
  while oActiveX : Playstate != 1
      SysRefresh()
   end

   MsgInfo( oActiveX : currentmedia:durationString )  // esta línea
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 43 guests