FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour TActiveX() (play a video or sound)
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
TActiveX() (play a video or sound)
Posted: Fri Jun 14, 2013 06: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.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TActiveX()
Posted: Fri Jun 14, 2013 08:23 PM
Adhemar,

Prueba con este c贸digo:

Code (fw): Select all Collapse
#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
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: TActiveX()
Posted: Sun Jun 16, 2013 10:43 AM
Gracias Antonio,
Funciona

Este es mi c贸digo:
Code (fw): Select all Collapse
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.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TActiveX()
Posted: Sun Jun 16, 2013 04:07 PM
Adhemar,

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

Prueba asi:

Code (fw): Select all Collapse
#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
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: TActiveX()
Posted: Mon Jun 17, 2013 01: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.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TActiveX()
Posted: Mon Jun 17, 2013 02: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
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: TActiveX()
Posted: Mon Jun 17, 2013 02:35 PM

Gracias Antonio

Estar茅 aguardando.

Saludos,

Adhemar

Saludos,



Adhemar C.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TActiveX()
Posted: Mon Jun 17, 2013 03: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
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: TActiveX()
Posted: Mon Jun 17, 2013 03: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.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TActiveX()
Posted: Mon Jun 17, 2013 03: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
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: TActiveX()
Posted: Mon Jun 17, 2013 05: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.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TActiveX()
Posted: Mon Jun 17, 2013 08:26 PM
Aqui lo tienes:

Code (fw): Select all Collapse
#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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TActiveX()
Posted: Mon Jun 17, 2013 09: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
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: TActiveX()
Posted: Tue Jun 18, 2013 01: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.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TActiveX()
Posted: Tue Jun 18, 2013 06:46 PM
A帽ade esta linea:

Code (fw): Select all Collapse
 聽 while oActiveX : Playstate != 1
聽 聽 聽 SysRefresh()
聽 聽end

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

Antonio Linares
www.fivetechsoft.com