Page 1 of 1

error on print from activex

Posted: Fri Dec 04, 2020 11:05 am
by Silvio.Falconi
give me this error

Time from start: 0 hours 0 mins 17 secs
Error occurred at: 12/04/20, 11:57:27
Error description: (DOS Error -2147352567) WINOLE/1007 (0x80040100): EXECWB
Args:
[ 1] = N 6
[ 2] = N 1

Stack Calls
===========
Called from: => TOLEAUTO:EXECWB( 0 )
Called from: => __OBJSENDMSG( 0 )
Called from: .\source\classes\ACTIVEX.PRG => TACTIVEX:DO( 96 )
Called from: => (b)EVAL( 506 )



Code: Select all

                   

#Define OLECMDID_PRINT 6
#Define OLECMDEXECOPT_PROMPTUSER 1
#Define OLECMDEXECOPT_DONTPROMPTUSER 2


  DEFINE BUTTON oBtn RESOURCE "STAMPA" OF oBar ;
                      ACTION  oActiveX:Do( "ExecWB", OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER ) ;
                      NOBORDER ;
                      TOOLTIP 'Stampa'

Re: error on print from activex

Posted: Fri Dec 04, 2020 1:02 pm
by karinha
What are you trying to do, something like that?

Code: Select all

#include "FiveWin.ch"

#define OLECMDID_PRINT 6
#define OLECMDEXECOPT_PROMPTUSER 1
#define OLECMDEXECOPT_DONTPROMPTUSER 2

FUNCTION Main()

   LOCAL cHtmlOrUrl, nCopies, lShow

   lShow      := .T.
   nCopies    := 1
   cHtmlOrUrl := "http://forums.fivetechsupport.com/viewtopic.php?f=3&t=27933"

   PrintHtml( cHtmlOrUrl, nCopies, lShow )

RETURN NIL

FUNCTION PrintHtml( cHtmlOrUrl, nCopies, lShow )

   STATIC oWnd := nil, oBar, oIe

   LOCAL I

   DEFAULT lShow := .F. , nCopies := 1

   IF oWnd = NIL

      DEFINE WINDOW oWnd

      DEFINE BUTTONBAR oBar OF oWnd

      DEFINE BUTTON OF oBar;
         PROMPT 'Print ';
         ACTION oIe:Do( "ExecWB", OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER )

      oIe = TActiveX():New( oWnd, "Shell.Explorer" )

   ENDIF

   oIe:Do( "Navigate2", cHtmlOrUrl )

   IF lshow

      oWnd:oClient = oIe

      ShowWindow( oWnd, 1 ) // 1=Show,0=hide

      ACTIVATE WINDOW oWnd

      oWnd:Center()

   ELSE

      FOR i = 1 TO nCopies

         MsgWait( 'Printing large receipt (' + alltrim( str(i ) ) + ' of ' + alltrim( str(nCopies ) ) + ' copies).', , 2 )

         oIe:Do( "ExecWB", OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER )

      NEXT i

   ENDIF

   Sysrefresh()

RETURN NIL