TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby dutch » Mon Mar 28, 2022 3:16 am

I've used WMPlayer.OCX to play MP4 file on Windows10. The memory leak after play 10 times from 1xx to 7xx MB. Then the vdo doesn't play anymore.

The code is below. How do I release memory used?

Thank you in advance for any idea or help.
Code: Select all  Expand view

...
ACTIVATE DIALOG oDlg CENTER ;
                            ON INIT  (BuildMPlayer2( oDlg, MEMVAR->cGifPath+"idcard.Mp4",  110+MEMVAR->nTopDlg, 151+nPlus2, 720, 406 ),

*--------------------------------------------------------------------------*
function BuildMPlayer2( oDlg, cFile, nTop, nLeft, nWidth, nHeight )

    Memory( -1 )
   
    oActiveX1 = TActiveX():New( oDlg, "WMPlayer.OCX",  nTop, nLeft, nWidth, nHeight )
   oActiveX1:Hide()
   oActiveX1:url = cFile
   oActiveX1:uiMode('none')
    oActiveX1:Settings:Volume = 0
    oActiveX1:Settings:AutoStart = .T.
   oActiveX1:StretchToFit = .T.
   oActiveX1:EnableContextMenu()
   oActiveX1:Settings:setMode("loop",.T.)

return nil
 
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby Jimmy » Mon Mar 28, 2022 4:14 am

hi Dutch,
oActiveX1 = TActiveX():New( oDlg, "WMPlayer.OCX", nTop, nLeft, nWidth, nHeight )

i think CLSID must be
Code: Select all  Expand view
"WMPlayer.OCX.7"

or
Code: Select all  Expand view
"{6BF52A52-394A-11d3-B153-00C04F79FAA6}"


---
you also can try VLC Player using this CLSID
Code: Select all  Expand view
"VideoLAN.VLCPlugin.2"
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby Antonio Linares » Mon Mar 28, 2022 9:47 am

Dear Dutch,

Please try this:

oActiveX1:Settings:setMode("loop",.T.)
oActiveX1 := nil
regards, saludos

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

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby dutch » Tue Mar 29, 2022 10:57 am

Dear Jimmy,

Thank you for your suggestion. What are different between "WMPlayer.OCX", "WMPlayer.OCX.7" and "{6BF52A52-394A-11d3-B153-00C04F79FAA6}"? It works as the same.
Jimmy wrote:hi Dutch,
oActiveX1 = TActiveX():New( oDlg, "WMPlayer.OCX", nTop, nLeft, nWidth, nHeight )

i think CLSID must be
Code: Select all  Expand view
"WMPlayer.OCX.7"

or
Code: Select all  Expand view
"{6BF52A52-394A-11d3-B153-00C04F79FAA6}"


---
you also can try VLC Player using this CLSID
Code: Select all  Expand view
"VideoLAN.VLCPlugin.2"
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby dutch » Tue Mar 29, 2022 11:00 am

Dear Antonio,

I search in internet and found below. It look better.
Code: Select all  Expand view
oActiveX1:url := ""
 


I will try as your suggestion and compare between below and above. I will let you know the result.
Antonio Linares wrote:Dear Dutch,

Please try this:

oActiveX1:Settings:setMode("loop",.T.)
oActiveX1 := nil


Thank you so much
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby Jimmy » Tue Mar 29, 2022 5:46 pm

hi Dutch,

you can use

CLSID
Code: Select all  Expand view
"{6BF52A52-394A-11d3-B153-00C04F79FAA6}"

or PROGID
Code: Select all  Expand view
"WMPlayer.OCX.7"


i wonder that it is working with "WMPlayer.OCX" without ".7"

---

you need to "destroy" ActiveX
Code: Select all  Expand view
oActiveX1 := nil

but only when not used any more

---

Code: Select all  Expand view
oActiveX1:url := ""

does assign "new" Media but here it is empty

---

i have to search in my Xbase++ / harbour Code how i "loop" but i "think" i don`t use it this Way
your Code does not use "Timeline" so you don`t have "CurrentPosition()" to identify "End of File"

i recommend to use a TIMER to get Property when "IsPlaying()"
at EOF (IF nPosi >= nDuration - 1) i "reset" Position and play it again

here some Code from my harbour Project, have a look a "nDuration"
Note : i use a own "Scrollbar" which can be used with Mouse-Wheel to find "quick" a Position
Code: Select all  Expand view
            nPlayState := o__WMP:PlayState()
            DO CASE
               CASE o__WMP:IsPlaying()

                  // show moving Slider when playing
                  DoMethod( "Form_1", "Setfocus" )
                  DoMethod( "Form_1", "oScroll", "Setfocus" )

                  nPosi := o__WMP:CurrentPosition()
                  cPosi := SEC2HMS( nPosi )
                  SbarText( cPosi, 2 )

                  nDuration := o__WMP:Duration()

                  IF !EMPTY( nDuration )
                     nScroll := nPosi
                     SetProperty( "Form_1", "oScroll", "VALUE", nScroll )

                     IF nPosi >= nDuration - 1
                        lFullScr := o__WMP:fullScreen()
                        SetProperty( "Form_1", "oScroll", "VALUE", 1 )
                        o__WMP:Stop()
                        ShowHideWMP( "HIDE" )

                        IF SP_Loop() = .T.
                           o__WMP:CurrentPosition( 1 )
                           o__WMP:Play()

                        ELSEIF SP_Endless()
                           //  Play_Next()
                           SENDKEY( VK_NEXT )
                        ENDIF
                     ENDIF
                  ENDIF

               CASE nPlayState = wmppsUndefined

               CASE nPlayState = wmppsStopped
                  cPosi := SEC2HMS( 0 )
                  SbarText( cPosi, 2 )

                  DoMethod( "Form_1", "Setfocus" )
                  SetProperty( "Form_1", "oScroll", "VALUE", 1 )

               CASE nPlayState = wmppsPaused
                  xKey := HMG_GetLastVirtualKeyDown()
                  IF xKey = VK_RETURN
                     PauseOrPlay()
                  ENDIF

               CASE nPlayState = wmppsScanForward
               CASE nPlayState = wmppsScanReverse
               CASE nPlayState = wmppsBuffering
                  SbarText( "Buffering ..." )
               CASE nPlayState = wmppsWaiting
               CASE nPlayState = wmppsMediaEnded
               CASE nPlayState = wmppsTransitioning                   // this event is after open Media
                  SbarText( "Transitioning ..." )
               CASE nPlayState = wmppsReady
               CASE nPlayState = wmppsReconnecting
               CASE nPlayState = wmppsLast

            ENDCASE


p.s.
i do use a Listbox as "Playlist" and not WMP-Playlist
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby dutch » Wed Mar 30, 2022 1:57 am

Dear Jimmy,

This is the code that I use for looping vdo play.
Code: Select all  Expand view
DEFINE DIALOG oDlg SIZE nWndWidth, nWndHeight ;
       STYLE nOr( WS_CHILD, WS_POPUP ) ;
       COLOR CLR_BLACK, CLR_WHITE ;
       FONT oFont60

    DEFINE TIMER oDlgCLose INTERVAL 10000 ACTION iif(MEMVAR->lCloseAll, (MEMVAR->lGoHome := .T., oDlg:End()), )
    DEFINE TIMER oTimer[1] INTERVAL 1500 ACTION (lOk := StartScan0(.T., MEMVAR->cImgPath+cTimeFile+'.JPG',.T., oTimer, oSay, oBmp), if(lOk, oDlg:End(), ))
    DEFINE TIMER oTimer[2] INTERVAL 100 ACTION (if(oActiveX2:controls:currentPosition > oActiveX2:currentMedia:duration - 0.02, (oActiveX2:controls:currentPosition := 0.02), if(oActiveX2:controls:currentPosition > 0.01, oActiveX2:Show() , ) ))

ACTIVATE DIALOG oDlg CENTER ;
                            ON INIT  (BuildMPlayer2( oDlg, MEMVAR->cGifPath+"idcard.Mp4",  110+MEMVAR->nTopDlg, 151+nPlus2, 720, 406 ), ;
                                         oTimer[1]:Activate(), ;
                                         oTimer[2]:Activate(), ;
                                         oDlgCLose:Activate(), ;                                 
                                         AddGif( oDlg, MEMVAR->cGifPath+"wait.gif" ), oGif:Hide()) ;
                            ON PAINT (Drawlight(oDlg, nTitleBox, 140+nPlus2, 740, 72 ), ;
                                         Drawlight(oDlg, 90+MEMVAR->nTopDlg, 131+nPlus2, 760, 446 )) ;
                            VALID   (oTimer[2]:Deactivate(), oTimer[2]:End(), ;
                                         oTimer[1]:Deactivate(), oTimer[1]:End(), ;
                                         oDlgCLose:Deactivate(), oDlgCLose:End(), ;
                                         oActiveX2:Url := nil, oActiveX2:Close(), ;
                                         .T.)

*--------------------------------------------------------------------------*
function BuildMPlayer2( oDlg, cFile, nTop, nLeft, nWidth, nHeight )

    Memory( -1 )

//      oActiveX2 = TActiveX():New( oDlg, "{6BF52A52-394A-11d3-B153-00C04F79FAA6}",  nTop, nLeft, nWidth, nHeight )
    oActiveX2 = TActiveX():New( oDlg, "WMPlayer.OCX.7",  nTop, nLeft, nWidth, nHeight )
//      oActiveX2 = TActiveX():New( oDlg, "WMPlayer.OCX",  nTop, nLeft, nWidth, nHeight )
   oActiveX2:Hide()
    oActiveX2:url = cFile
   oActiveX2:uiMode('none')
    oActiveX2:Settings:Volume = 0
    oActiveX2:Settings:AutoStart = .T.
   oActiveX2:StretchToFit = .T.
   oActiveX2:EnableContextMenu()
   oActiveX2:Settings:setMode("loop",.T.)

return nil

 

Jimmy wrote:hi Dutch,

you can use

CLSID
Code: Select all  Expand view
"{6BF52A52-394A-11d3-B153-00C04F79FAA6}"

or PROGID
Code: Select all  Expand view
"WMPlayer.OCX.7"


i wonder that it is working with "WMPlayer.OCX" without ".7"

---

you need to "destroy" ActiveX
Code: Select all  Expand view
oActiveX1 := nil

but only when not used any more

---

Code: Select all  Expand view
oActiveX1:url := ""

does assign "new" Media but here it is empty

---

i have to search in my Xbase++ / harbour Code how i "loop" but i "think" i don`t use it this Way
your Code does not use "Timeline" so you don`t have "CurrentPosition()" to identify "End of File"

i recommend to use a TIMER to get Property when "IsPlaying()"
at EOF (IF nPosi >= nDuration - 1) i "reset" Position and play it again

here some Code from my harbour Project, have a look a "nDuration"
Note : i use a own "Scrollbar" which can be used with Mouse-Wheel to find "quick" a Position
Code: Select all  Expand view
            nPlayState := o__WMP:PlayState()
            DO CASE
               CASE o__WMP:IsPlaying()

                  // show moving Slider when playing
                  DoMethod( "Form_1", "Setfocus" )
                  DoMethod( "Form_1", "oScroll", "Setfocus" )

                  nPosi := o__WMP:CurrentPosition()
                  cPosi := SEC2HMS( nPosi )
                  SbarText( cPosi, 2 )

                  nDuration := o__WMP:Duration()

                  IF !EMPTY( nDuration )
                     nScroll := nPosi
                     SetProperty( "Form_1", "oScroll", "VALUE", nScroll )

                     IF nPosi >= nDuration - 1
                        lFullScr := o__WMP:fullScreen()
                        SetProperty( "Form_1", "oScroll", "VALUE", 1 )
                        o__WMP:Stop()
                        ShowHideWMP( "HIDE" )

                        IF SP_Loop() = .T.
                           o__WMP:CurrentPosition( 1 )
                           o__WMP:Play()

                        ELSEIF SP_Endless()
                           //  Play_Next()
                           SENDKEY( VK_NEXT )
                        ENDIF
                     ENDIF
                  ENDIF

               CASE nPlayState = wmppsUndefined

               CASE nPlayState = wmppsStopped
                  cPosi := SEC2HMS( 0 )
                  SbarText( cPosi, 2 )

                  DoMethod( "Form_1", "Setfocus" )
                  SetProperty( "Form_1", "oScroll", "VALUE", 1 )

               CASE nPlayState = wmppsPaused
                  xKey := HMG_GetLastVirtualKeyDown()
                  IF xKey = VK_RETURN
                     PauseOrPlay()
                  ENDIF

               CASE nPlayState = wmppsScanForward
               CASE nPlayState = wmppsScanReverse
               CASE nPlayState = wmppsBuffering
                  SbarText( "Buffering ..." )
               CASE nPlayState = wmppsWaiting
               CASE nPlayState = wmppsMediaEnded
               CASE nPlayState = wmppsTransitioning                   // this event is after open Media
                  SbarText( "Transitioning ..." )
               CASE nPlayState = wmppsReady
               CASE nPlayState = wmppsReconnecting
               CASE nPlayState = wmppsLast

            ENDCASE


p.s.
i do use a Listbox as "Playlist" and not WMP-Playlist
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby dutch » Wed Mar 30, 2022 2:02 am

This is the vdo that I need to play.

https://youtu.be/eaiuWMHL8O0
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby cmsoft » Wed Mar 30, 2022 3:07 am

Hi Dutch,
Today I have something like this running a video running in a loop, and it never stops.
It is an informative terminal and shows the shifts.
Adapt it so you get the idea.
I hope it helps you.
Code: Select all  Expand view

#include "FiveWin.ch"
#include "layout.ch"
#include "xbrowse.ch"
STATIC oActiveX, oBrw, aDatos

function main()
    local oWnd, oTimer
    local oMainLay
    local hLays := {=>}
    local hButtons := {=>}
    local hBrowses := {=>}
    local oFld, oTitle2, oFont3
   
    DEFINE FONT oFont3 NAME "Calibri" size 30, 60 BOLD NESCAPEMENT 900

    DEFINE window oWnd STYLE nOr( WS_POPUP, WS_VISIBLE )
    DEFINE TIMER oTimer INTERVAL 10000 OF oWnd ACTION LlamaTurno()
  ACTIVATE TIMER oTimer

    DEFINE LAYOUT hLays["MAIN"] of oWnd

    DEFINE HORIZONTAL LAYOUT hLays["H1"] of hLays["MAIN"] size 75
 
    DEFINE VERTICAL LAYOUT hLays["H2"] of hLays["MAIN"]
    DEFINE VERTICAL LAYOUT hLays["H3"] of hLays["MAIN"]

    DEFINE HORIZONTAL LAYOUT of hLays["H2"]
   
   
   
    DEFINE HORIZONTAL LAYOUT hLays["H1_1"] of hLays["H2"]:aHLayout[1]
    DEFINE HORIZONTAL LAYOUT hLays["H1_2"] of hLays["H2"]:aHLayout[1]   
  aDatos := {}
    PlayVideo ( hLays["H1_1"] )
    Imagen( hLays["H1_2"] )
    Browse_turnos( hLays["H3"] )
   
    ACTIVATE WINDOW oWnd MAXIMIZED ON init ( hLays["H1_1"] ):SetFocus()

return nil

STATIC function Browse_turnos( oWnd )
    @ 00, 00 XBROWSE oBrw ARRAY aDatos;
        COLUMNS 1,2,3;
        HEADERS "Lugar","Apellido y Nombres","Documento";
        SIZES 300,500,300 OF oWnd SIZE 300, 200 PIXEL ON DBLCLICK oWnd:End()    COLOR  CLR_WHITE, nRGB(228,079,150)
   PintaBrw(oBrw,0)
   oBrw:CreateFromCode()
   SET LAYOUT CONTROL oBrw OF oWnd
return nil


// ----------------------------------------------//
// -----------  Variables Globales del PRG ------//
// ----------------------------------------------//

//----------------------------------------------------------------------------//


****************************************************
** Llama turno en recaudacion
STATIC FUNCTION LlamaTurno()
LOCAL aLugar := {"Urgencias","Reclamos","Administracion"},aNombres := {"Juan","Pedro","Antonio","Dutch","Cesar"}
AINS(aDatos,1,{aLugar[HB_RandomInt(3)],aNombres[HB_RandomInt(5)],STR(HB_RandomInt(250000))},.T.)
oBrw:Refresh()
SndPlaySound("..\SOUNDS\info.wav",0)  
RETURN nil


******************************
** Mostrar Video
STATIC FUNCTION PlayVideo( oWnd)
oActiveX = TActiveX():New( oWnd, "WMPlayer.OCX" )
__KeyBoard(chr(13))
oWnd:oClient = oActiveX
oActiveX:Settings:Volume := 1.5
oActiveX:Settings:SetMode("loop",.t.)
oActiveX:uiMode = "none"
oActiveX:url ="C:\fwh16\avis\fivewin.avi"
SET LAYOUT CONTROL oActiveX OF oWnd
Return NIL

******************************
** Mostrar Imagen
STATIC function Imagen (oWnd)
local oImg
@ 00, 00 IMAGE oImg OF oWnd FILE "..\BITMAPS\OLGA1.JPG" SIZE 350,350 NOBORDER ADJUST UPDATE
SET LAYOUT CONTROL oImg of oWnd
return nil

***************************************************************************
** Pinta los browse
FUNCTION PintaBrw(oBrw,C)
LOCAL i,nColTam,nFaltante , oFont
     DEFINE FONT oFont NAME "Calibri" SIZE 0, -34
     oBrw:bClrStd := { || If( oBrw:KeyNo() % 2 == 0, ;
                         { CLR_BLACK, nRGB(238,091,153) }, ;
                         { CLR_BLACK, nRGB(96,207,62) } ) }
     oBrw:SetFont( oFont, .t. )
     oBrw:nStretchCol := STRETCHCOL_LAST
     oBrw:l2007 := .f.
     oBrw:bClrHeader := { || { CLR_WHITE, nRGB(19, 141, 117) } }
     *oBrw:lColDividerComplete  := .t.                    
     oBrw:nColDividerStyle     := 0
     oBrw:nRowDividerStyle     := 0
     oBrw:nHeadDividerStyle    := 0
     oBrw:lFooter := oBrw:lHScroll := oBrw:lVScroll := oBrw:lRecordSelector := .f.


     **************************************AJUSTAR COLUMNAS********************************
     IF C> 0
      nColTam:=0
      FOR i := 1 TO C
       nColTam:= (nColTam + oBrw:aCols[ i ]:nWidth)
      NEXT
      IF nColTam < 761
         nFaltante:= 761 - nColTam - 1.5
         oBrw:aCols[ C ]:nWidth:= (oBrw:aCols[ C ]:nWidth + nFaltante)
      ENDIF  
     ENDIF
RETURN nil
 
User avatar
cmsoft
 
Posts: 1289
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby Jimmy » Wed Mar 30, 2022 6:09 am

hi Dutch,

OK, you have a TIMER and got Property

dutch wrote:This is the code that I use for looping vdo play.
Code: Select all  Expand view
function BuildMPlayer2( oDlg, cFile, nTop, nLeft, nWidth, nHeight )
  ...
   oActiveX2:url = cFile   


try change that line as "last" line

this is the Place when load/play different Media.

---

about "WMPlayer.OCX" without ".7"
have found out that it work as "VersionIndependentProgID"

have not see it before while most CLSID or PROGID are used, sorry
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby dutch » Wed Mar 30, 2022 10:37 am

Dear cmsoft,

Thank you for your idea. I will try as your suggestion.
cmsoft wrote:Hi Dutch,
Today I have something like this running a video running in a loop, and it never stops.
It is an informative terminal and shows the shifts.
Adapt it so you get the idea.
I hope it helps you.
Code: Select all  Expand view

#include "FiveWin.ch"
#include "layout.ch"
#include "xbrowse.ch"
STATIC oActiveX, oBrw, aDatos

function main()
    local oWnd, oTimer
    local oMainLay
    local hLays := {=>}
    local hButtons := {=>}
    local hBrowses := {=>}
    local oFld, oTitle2, oFont3
   
    DEFINE FONT oFont3 NAME "Calibri" size 30, 60 BOLD NESCAPEMENT 900

    DEFINE window oWnd STYLE nOr( WS_POPUP, WS_VISIBLE )
    DEFINE TIMER oTimer INTERVAL 10000 OF oWnd ACTION LlamaTurno()
  ACTIVATE TIMER oTimer

    DEFINE LAYOUT hLays["MAIN"] of oWnd

    DEFINE HORIZONTAL LAYOUT hLays["H1"] of hLays["MAIN"] size 75
 
    DEFINE VERTICAL LAYOUT hLays["H2"] of hLays["MAIN"]
    DEFINE VERTICAL LAYOUT hLays["H3"] of hLays["MAIN"]

    DEFINE HORIZONTAL LAYOUT of hLays["H2"]
   
   
   
    DEFINE HORIZONTAL LAYOUT hLays["H1_1"] of hLays["H2"]:aHLayout[1]
    DEFINE HORIZONTAL LAYOUT hLays["H1_2"] of hLays["H2"]:aHLayout[1]   
  aDatos := {}
    PlayVideo ( hLays["H1_1"] )
    Imagen( hLays["H1_2"] )
    Browse_turnos( hLays["H3"] )
   
    ACTIVATE WINDOW oWnd MAXIMIZED ON init ( hLays["H1_1"] ):SetFocus()

return nil

STATIC function Browse_turnos( oWnd )
    @ 00, 00 XBROWSE oBrw ARRAY aDatos;
        COLUMNS 1,2,3;
        HEADERS "Lugar","Apellido y Nombres","Documento";
        SIZES 300,500,300 OF oWnd SIZE 300, 200 PIXEL ON DBLCLICK oWnd:End()    COLOR  CLR_WHITE, nRGB(228,079,150)
   PintaBrw(oBrw,0)
   oBrw:CreateFromCode()
   SET LAYOUT CONTROL oBrw OF oWnd
return nil


// ----------------------------------------------//
// -----------  Variables Globales del PRG ------//
// ----------------------------------------------//

//----------------------------------------------------------------------------//


****************************************************
** Llama turno en recaudacion
STATIC FUNCTION LlamaTurno()
LOCAL aLugar := {"Urgencias","Reclamos","Administracion"},aNombres := {"Juan","Pedro","Antonio","Dutch","Cesar"}
AINS(aDatos,1,{aLugar[HB_RandomInt(3)],aNombres[HB_RandomInt(5)],STR(HB_RandomInt(250000))},.T.)
oBrw:Refresh()
SndPlaySound("..\SOUNDS\info.wav",0)  
RETURN nil


******************************
** Mostrar Video
STATIC FUNCTION PlayVideo( oWnd)
oActiveX = TActiveX():New( oWnd, "WMPlayer.OCX" )
__KeyBoard(chr(13))
oWnd:oClient = oActiveX
oActiveX&#058;Settings:Volume := 1.5
oActiveX&#058;Settings:SetMode("loop",.t.)
oActiveX&#058;uiMode = "none"
oActiveX&#058;url ="C:\fwh16\avis\fivewin.avi"
SET LAYOUT CONTROL oActiveX OF oWnd
Return NIL

******************************
** Mostrar Imagen
STATIC function Imagen (oWnd)
local oImg
@ 00, 00 IMAGE oImg OF oWnd FILE "..\BITMAPS\OLGA1.JPG" SIZE 350,350 NOBORDER ADJUST UPDATE
SET LAYOUT CONTROL oImg of oWnd
return nil

***************************************************************************
** Pinta los browse
FUNCTION PintaBrw(oBrw,C)
LOCAL i,nColTam,nFaltante , oFont
     DEFINE FONT oFont NAME "Calibri" SIZE 0, -34
     oBrw:bClrStd := { || If( oBrw:KeyNo() % 2 == 0, ;
                         { CLR_BLACK, nRGB(238,091,153) }, ;
                         { CLR_BLACK, nRGB(96,207,62) } ) }
     oBrw:SetFont( oFont, .t. )
     oBrw:nStretchCol := STRETCHCOL_LAST
     oBrw:l2007 := .f.
     oBrw:bClrHeader := { || { CLR_WHITE, nRGB(19, 141, 117) } }
     *oBrw:lColDividerComplete  := .t.                    
     oBrw:nColDividerStyle     := 0
     oBrw:nRowDividerStyle     := 0
     oBrw:nHeadDividerStyle    := 0
     oBrw:lFooter := oBrw:lHScroll := oBrw:lVScroll := oBrw:lRecordSelector := .f.


     **************************************AJUSTAR COLUMNAS********************************
     IF C> 0
      nColTam:=0
      FOR i := 1 TO C
       nColTam:= (nColTam + oBrw:aCols[ i ]:nWidth)
      NEXT
      IF nColTam < 761
         nFaltante:= 761 - nColTam - 1.5
         oBrw:aCols[ C ]:nWidth:= (oBrw:aCols[ C ]:nWidth + nFaltante)
      ENDIF  
     ENDIF
RETURN nil
 
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: TActiveX():New( oDlg, "WMPlayer.OCX" .... ) memory leak

Postby dutch » Wed Mar 30, 2022 10:39 am

Dear Jimmy,

Thank you, I got it now.
Jimmy wrote:hi Dutch,

OK, you have a TIMER and got Property

dutch wrote:This is the code that I use for looping vdo play.
Code: Select all  Expand view
function BuildMPlayer2( oDlg, cFile, nTop, nLeft, nWidth, nHeight )
  ...
   oActiveX2:url = cFile   


try change that line as "last" line

this is the Place when load/play different Media.

---

about "WMPlayer.OCX" without ".7"
have found out that it work as "VersionIndependentProgID"

have not see it before while most CLSID or PROGID are used, sorry
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 69 guests