Page 1 of 1
How to do my question ?
Posted: Thu May 28, 2020 5:21 pm
by yunbg1
Dear Antonio Linares.
How to do my question ?
When using activeX "AcroPDF.PDF.1"
How to receive event (current status) in activeX?
For example, I want to know the event or status value when the printWithDialog () window is closed.
Thank you.
Re: How to do my question ?
Posted: Thu May 28, 2020 7:47 pm
by Antonio Linares
Please review FWH\samples\webexp.prg to review how to manage the ActiveX events
Re: How to do my question ?
Posted: Thu May 28, 2020 11:01 pm
by yunbg1
Code: Select all
#include "FiveWin.ch"
//---------------------------------------------------------------------------------------------------
FUNC Test()
publ oWnd_Main, oDlgW, oActiveX
publ cEvents := ""
DEFINE WINDOW oWnd_Main FROM 0, 0 TO 48, 128 TITLE "PDF.Print"
//sample #1
/*
DEFINE DIALOG oDlgW OF oWnd_Main FROM 110, 20 TO 730, 300 TITLE "" STYLE nOr(DS_MODALFRAME) PIXEL
oActiveX := TActiveX():New( oDlgW, "AcroPDF.PDF.1" )
oDlgW:oClient := oActiveX
oActiveX:bOnEvent := { | event, aParams, pParams | EventInfo( event, aParams, pParams ) }
ACTIVATE DIALOG oDlgW NOWAIT ON INIT pdf_run(0)
*/
//sample #2
@ 0, 0 ACTIVEX oActiveX PROGID "AcroPDF.PDF.1" OF oWnd_Main
oActiveX := TActiveX():New( oWnd_Main, "AcroPDF.PDF.1" )
oWnd_Main:oClient := oActiveX
oActiveX:bOnEvent = { | event, aParams, pParams | cEvents += EventInfo( event, aParams, pParams ) }
ACTIVATE WINDOW oWnd_Main ON INIT pdf_run(0) VALID ( MemoEdit( cEvents ), .t. )
RETU NIL
//----------------------------------------------------------------------------
FUNC pdf_run()
oActiveX:Do( "LoadFile", curdrive1()+"\test.pdf" )
oActiveX:Do( "SetCurrentPage", 1 )
oActiveX:Do("SetShowToolbar", 0)
oActiveX:Do("SetView", "fit")
oActiveX:Do("SetPageMode", "none")
oActiveX:Do("SetShowScrollbars", 0)
oActiveX:Do("SetPageMode", "bookmarks")
RETU NIL
//----------------------------------------------------------------------------
FUNC EventInfo( event, aParams, pParams )
cMsg := "Event: " + cValToChar( event ) + CRLF
cMsg += "Params: " + CRLF
for n := 1 to Len( aParams )
cMsg += cValToChar( aParams[ n ] ) + CRLF
next
file_name := curdrive1()+"\log_activex"+".txt"
LogFile( file_name, { cMsg } )
//event := cValToChar( event )
RETU cMsg+CRLF
//------------------------------------------------------------------------------
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
HB_FUNC(CURDRIVE1)
{
char buffer[1024];
GetCurrentDirectory(MAX_PATH, buffer);
hb_retc(buffer);
}
#pragma ENDDUMP
he "webexp.prg" sample works fine
But look at what's wrong with "AcroPDF.PDF.1"