ActiveX

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

ActiveX

Post by Pablo César »

Is there any function in Harbour equivalent IsActivex() of FiveWin ?
I would like to know if Adobe is already installed before execute load() of object of TActiveX() ?
I have looking for a solution but I dont foud it, like this in FiveWin:

Code: Select all

    Function test PDFActivex(oWnd)
       MyProgID := ""
       if IsActivex( "PDF.PdfCtrl.1" ); MyProgID := "PDF.PdfCtrl.1"; endif
       if IsActivex( "PDF.PdfCtrl.2" ); MyProgID := "PDF.PdfCtrl.2"; endif
       if IsActivex( "PDF.PdfCtrl.3" ); MyProgID := "PDF.PdfCtrl.3"; endif
       if IsActivex( "PDF.PdfCtrl.4" ); MyProgID := "PDF.PdfCtrl.4"; endif
       if IsActivex( "PDF.PdfCtrl.5" ); MyProgID := "PDF.PdfCtrl.5"; endif
       if IsActivex( "PDF.PdfCtrl.6" ); MyProgID := "PDF.PdfCtrl.6"; endif
       if IsActivex( "PDF.PdfCtrl.7" ); MyProgID := "PDF.PdfCtrl.7"; endif
       if Empty( MyProgID )
          MsgStop( 'No PDF Activex installed' )
          return .f.
       endif
       ActiveX = TActiveX():New( oWnd, MyProgID )
       return .t.
There are also in Java, VBasic and JScript but I do not found for Harbour. Otherwise system is reporting error:

Error WINOLE/1009 No exported method: LOADFILE (DOS Error -2147352570)

Called from TOLEAUTO:LOADFILE(0)
Called from FOPENACTIVEX(69)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

ActiveX - Check if Adobe Reader is already installed

Post by Pablo César »

I did not know that GetActiveObject() also existed in the Harbour ... so it was easy to implement with my own function of IsActivex() and created and new command just to make equivalence from xHarbour to Harbour with TRY / CATCH by BEGIN SEQUENCE / RECOVER and the code stayed like this:

Code: Select all

#xcommand TRY              => BEGIN SEQUENCE WITH { |e| break( e ) }
#xcommand CATCH [] => RECOVER [USING ] <-oErr->

..//..
   MyProgID := ""
   For i=1 to 9
       if IsActivex( "PDF.PdfCtrl."+Str(i,1,0) ); MyProgID := "PDF.PdfCtrl."+Str(i,1,0); endif
   Next
   if IsActivex( "AcroPDF.PDF.1" ); MyProgID := "AcroPDF.PDF.1"; endif
   If Empty( MyProgID )
      MsgStop( 'Deve instalar o Adobe Reader !' )
      Return .f.
   Endif
..//..

FUNCTION IsActivex(cACTIVEX)
TRY
   oWord := GetActiveObject( cACTIVEX )
CATCH e
   TRY
      oWord := CreateObject( cACTIVEX )
   CATCH e
      RETURN(.F.)
   END
END
RETURN(.T.)
Who is interested to see how it is, see at this new topic: http://hmgforum.com/viewtopic.php?f=9&t=2130
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
tave2009
Posts: 61
Joined: Tue Jul 14, 2009 3:33 am
Location: San Francisco, Córdoba, Argentina.

Re: ActiveX

Post by tave2009 »

Hola Pablo,
Excelente !
Aquí hay un Activex gratis. Generador de reportes, Vista previa e Impresión http://www.catchysoft.com/
Muy simple pero efectivo.
Si alguien tiene otro link que lo publique. Gracias.
Saludos.
Walter
Nada se pierde. Todo se transforma. (Lavoussier)
Nothing is lost. Everything changes.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: ActiveX

Post by Pablo César »

Gracias Walter, muy interesante !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply