how to "test" if ACTIVEX was create ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

how to "test" if ACTIVEX was create ?

Post by AUGE_OHR »

hi,

i can create a ACTIVEX ... even when PROGID does not exist :o

this Sample, using Windows Media Player, should work while it is default in Windows OS
when change PROGID it should fail ... but how to "identify Error" (ACTIVEX does not exist) :?:

Code: Select all

#include "hmg.ch"
MEMVAR _HMG_SYSDATA
PROCEDURE Main()

   DEFINE WINDOW Form_1 ;
         AT 0, 0 ;
         WIDTH  800 ;
         HEIGHT 600 ;
         TITLE "Test ActiveX " ;
         ON INIT INIT_WMP() ;
         MAIN

         DEFINE ACTIVEX oxWMP
            PARENT Form_1
            ROW 0
            COL 0
            WIDTH  800
            HEIGHT 600
            PROGID "WMPlayer.OCX.7"  // this PROGID work ... change it to "DUMMY.OCX"
         END ACTIVEX
   END WINDOW

   CENTER WINDOW Form_1
   ACTIVATE WINDOW Form_1
RETURN

Code: Select all

PROCEDURE INIT_WMP()
LOCAL oWMP

   oWMP := GetProperty("Form_1","oxWMP")
   msgdebug("Type "+ VALTYPE(oWMP))  // -> "U"

   oWMP := Form_1.oxWMP.OBJECT
   msgdebug("Type "+ VALTYPE(oWMP))  // -> "O"

   msgdebug("Version " + oWMP:versionInfo) // will crash if wrong PROGID
RETURN
have fun
Jimmy
User avatar
gfilatov
Posts: 1060
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: how to "test" if ACTIVEX was create ?

Post by gfilatov »

AUGE_OHR wrote: Mon May 17, 2021 5:01 am hi,

i can create a ACTIVEX ... even when PROGID does not exist :o

this Sample, using Windows Media Player, should work while it is default in Windows OS
when change PROGID it should fail ... but how to "identify Error" (ACTIVEX does not exist) :?:
Hi Jimmy,

Please try the following updated sample:

Code: Select all

#include "hmg.ch"

PROCEDURE Main()

   DEFINE WINDOW Form_1 ;
         AT 0, 0 ;
         WIDTH  800 ;
         HEIGHT 600 ;
         TITLE "Test ActiveX " ;
         ON INIT INIT_WMP() ;
         MAIN

         DEFINE ACTIVEX oxWMP
            PARENT Form_1
            ROW 0
            COL 0
            WIDTH  800
            HEIGHT 600
            PROGID "DUMMY" //"WMPlayer.OCX.7"  // this PROGID work ... change it to "DUMMY.OCX"
         END ACTIVEX
   END WINDOW

   CENTER WINDOW Form_1
   ACTIVATE WINDOW Form_1
RETURN

PROCEDURE INIT_WMP()
LOCAL oWMP, cVersionInfo

   oWMP := Form_1.oxWMP.OBJECT

   BEGIN SEQUENCE WITH __BreakBlock()
      cVersionInfo := oWMP:versionInfo
      msgdebug("Version " + cVersionInfo)
   RECOVER
      msgSTOP("Wrong PROGID!")
   END
RETURN
HTH :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: how to "test" if ACTIVEX was create ?

Post by AUGE_OHR »

thx for Answer.

---

is

Code: Select all

   BEGIN SEQUENCE WITH __BreakBlock()

STATIC function __BreakBlock()
   RETURN { | oErr | Break( oErr ) }
the same as

Code: Select all

   bOldError := ERRORBLOCK( { | e | BREAK( e ) } )
   BEGIN SEQUENCE

   RECOVER USING oError
      ERRORBLOCK( bOldError )
---

my Problem are that on 1 PC (!) my 64 Bit App fail ... Yes it is 64 Bit Windows OS

Code: Select all

STATIC PROCEDURE INIT_WMP()
LOCAL bOldError, oError

      bOldError := ERRORBLOCK( { | e | BREAK( e ) } )
      BEGIN SEQUENCE
         o__WMP := TWMP() :New( Form_1.oxWMP.Object )

Code: Select all

METHOD New( oActiveX ) CLASS TWMP
LOCAL bOldError, oError

   IF HB_ISOBJECT( oActiveX )
      bOldError := ERRORBLOCK( { | e | BREAK( e ) } )
      BEGIN SEQUENCE
         ::oWMP := oActiveX
it DID "pass" both but when call

Code: Select all

   METHOD GetVersion() INLINE ::oWMP:versionInfo
it does crash on "that" PC with 64 Bit ... it work when use 32 Bit ...

i have run "SFC /Scannow" and did a "inplace Upgrade" to get a "fresh" Version but still the same.
so what can i do "more" :idea:

p.s. in MiniGUI Extendet Version i found EnablePermissions() ... what are this for :?:
have fun
Jimmy
Post Reply