Page 1 of 1

Flash with DCACTIVEXCONTROL

Posted: Tue May 03, 2011 1:26 am
by c-tec
Hello,
have tried to make a little testprogram to call a swf file, but I think I am missing something, because the flash does not start.
regards
Rudolf

Code: Select all

//////////////////////////////////////////////////////////////////////
//
//  FLASH
//
//////////////////////////////////////////////////////////////////////

#INCLUDE "dcdialog.CH"
#PRAGMA LIBRARY( "ASCOM10.LIB" )

#PRAGMA LIBRARY( "XPPUI2.LIB" )

* -------------

PROCEDURE Main()
******************************************************************
LOCAL GetList[0], oFlash, oStatusBar, oToolBar, oStatic, oDlg, GetOptions

DCSTATUSBAR oStatusBar ALIGN DCGUI_ALIGN_TOP HEIGHT 25

@ 0,0 DCTOOLBAR oToolBar SIZE 100,25 PIXEL PARENT oStatusBar

DCADDBUTTON CAPTION 'Load Flash' SIZE 200,25 PIXEL PARENT oToolBar ACTION {||LoadFlash(oFlash)}

DCADDBUTTON CAPTION 'Exit' SIZE 50,25 PIXEL PARENT oToolBar ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}

@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT SIZE 500, 500 PIXEL OBJECT oStatic

@ 0,0 DCACTIVEXCONTROL oFlash SIZE 500,500  CLSID "{D27CDB6E-AE6D-11cf-96B8-444553540000}" PARENT oStatic

DCGETOPTIONS AUTORESIZE

DCREAD GUI FIT OPTIONS GetOptions TITLE 'Flash Test' SETAPPWINDOW

RETURN

* -------------

PROCEDURE AppSys()
RETURN

* ---------------

PROCEDURE LoadFlash( oFlash )
******************************************************************
LOCAL cFileName
/*
cFileName := DC_PopFile( nil, nil, nil, 'Load a Flash File...', ;
                         { {"Flash FIles","*.swf"}, {"All Files","*.*"} } )
*/
cFileName := "test.swf"
IF Empty(cFileName)
  RETURN
ENDIF

oFlash:loadmovie(0,cFileName)
oFlash:play()
RETURN


Re: Flash with DCACTIVEXCONTROL

Posted: Tue May 03, 2011 7:48 am
by rdonnay
Have you tried using the universal web browser control to run Flash?

@ 0,0 DCHTMLVIEWER oHtmlViewer SIZE 100,25 ;
NAVIGATE 'c:\test\test.swf' ;
RESIZE DCGUI_RESIZE_RESIZEONLY ;

Re: Flash with DCACTIVEXCONTROL

Posted: Wed May 04, 2011 12:22 am
by c-tec
Hello Roger,
if I use DCHTMLVIEWER I loose control over Flash. Jimmy has sent me a sample without eXPress++ that works so far, but if I load swf file and play it, the control hangs after finishing.
Here is his code that works. Why does my eXPress++ code not work ? I see no difference on starting the ActiveX Control ?
I need to implement a flash flipbook swf in my eXPress++ application and buttons to browse through pictures.
regards
Rudolf

Code: Select all


///////////////////////////////////////////////////////////////////////////////
//
//  Vom Xbase++ FormDesigner generierter Klassen Code
//    Erstellt am: 03.05.11 Zeit: 19:20:37
//
//  Contents  :
//    Diese Datei enth„lt die Implementierungsebene eines Formulares und
//    wird vom Xbase++ FormDesigner automatisch berschrieben. Sie sollte
//    niemals editiert werden, da die Žnderungen verloren gehen k”nnten.
//
///////////////////////////////////////////////////////////////////////////////

#ifndef _NEWFORM_
#define _NEWFORM_

#include "Gra.ch"
#include "Xbp.ch"
#include "Common.ch"
#include "Appevent.ch"
#include "Font.ch"

#PRAGMA LIBRARY( "ASCOM10.LIB" )

CLASS _NewForm FROM XbpDialog
   EXPORTED:
      VAR editControls

      * Enthaltene Kontrollelemente
      VAR oOFlash
      VAR oPbOO  

      METHOD init
      METHOD create
ENDCLASS

******************************************************************************
* Formular initialisieren
******************************************************************************
METHOD _NewForm:init( oParent, oOwner, aPos, aSize, aPP, lVisible )


   DEFAULT oParent  TO AppDesktop(), ;
           aPos     TO {2,1}, ;
           lVisible TO .F.

   DEFAULT aPP TO {}
   AAdd ( aPP, { XBP_PP_COMPOUNDNAME, "8.Arial" } )
   
   IF Empty(aSize) == .T.
      IF IsMemberVar(self,"ClientSize") == .T.
         aSize := {0,0}
      ELSE
         aSize := {421,479}
      ENDIF
   ENDIF
   
   ::XbpDialog:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
   IF aSize[1] == 0 .AND. aSize[2] == 0
      ::XbpDialog:ClientSize := {413,445}
   ENDIF
   ::XbpDialog:taskList := .T.
   ::XbpDialog:title := "Neues Formular"

   ::editControls := {}

   ::oOFlash := XbpActiveXControl():new( ::drawingArea, , {8,60}, {396,376} )
   ::oOFlash:CLSID := "{D27CDB6E-AE6D-11cf-96B8-444553540000}"
   ::oOFlash:TabStop := .T.

   ::oPbOO   := XbpPushButton():new( ::drawingArea, , {152,12}, {100,32}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
   ::oPbOO:caption := "load"
   ::oPbOO:tabStop := .T.
   ::oPbOO:activate := {|| NIL }

RETURN self


******************************************************************************
* Systemresourcen anfordern
******************************************************************************
METHOD _NewForm:create( oParent, oOwner, aPos, aSize, aPP, lVisible )

   ::XbpDialog:create( oParent, oOwner, aPos, aSize, aPP, lVisible )

   ::oOFlash:create()

   ::oPbOO:create()


RETURN self

#endif

//EOF
/////




#include "Gra.ch"
#include "Xbp.ch"
#include "Common.ch"
#include "Appevent.ch"
#include "Font.ch"

#pragma library("XppUi2")

PROCEDURE Appsys
RETURN

PROCEDURE Main
LOCAL nEvent, oXbp, mp1, mp2
LOCAL oDlg

   oDlg := NewForm():New()
   oDlg:oPbOO:activate := {|| oDlg:Load2() }
   oDlg:Create()

   CenterControl(oDlg)
   SetAppWindow(oDlg)
   SetAppFocus(oDlg)
   SetAppFocus(oDlg:oPbOO)

   nEvent := xbe_None
   WHILE nEvent != xbeP_Close
      nEvent := AppEvent ( @mp1, @mp2, @oXbp )
      oXbp:HandleEvent ( nEvent, mp1, mp2 )
      IF nEvent == xbeP_Quit
         QUIT   // AppQuit()
      ENDIF
   ENDDO

RETURN

CLASS NewForm FROM _NewForm
   EXPORTED:
      METHOD init
      METHOD create

      METHOD Load2
ENDCLASS

METHOD NewForm:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
   ::_NewForm:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
RETURN self

METHOD NewForm:create( oParent, oOwner, aPos, aSize, aPP, lVisible )
   ::_NewForm:create( oParent, oOwner, aPos, aSize, aPP, lVisible )
   ::show()
RETURN self

METHOD NewForm:Load2()
LOCAL oFileDlg, aFiles := {}
LOCAL aFilters := { {"Media Files","*.SWF"} }

   oFileDlg   := XbpFileDialog():new()
   oFileDlg:fileFilters := aFilters
   oFileDlg:center      := .T.
   oFileDlg:create( ::DrawingArea )
   aFiles := oFileDlg:open(,.T.,.F.)         // single

   IF EMPTY(aFiles)
   ELSE
      ::oOFlash:loadmovie(0,aFiles)
      ::oOFlash:play()
   ENDIF

RETURN self

* Programmcode fr die Implementierungsebene der Klasse einfgen
#include "_FLASH.PRG"


Re: Flash with DCACTIVEXCONTROL

Posted: Wed May 04, 2011 7:34 am
by rdonnay
If you give me some eXpress++ code that I can compile and run, then maybe I can figure this out, otherwise I would have no idea.

Re: Flash with DCACTIVEXCONTROL

Posted: Thu May 05, 2011 6:38 am
by c-tec
Hello Roger,
this is the whole sample. The window keeps black, but it seems that something happens in the background because the gets inactive when opening the swf file.
regards
Rudolf