Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I have IE print from VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00922610
Message ID:
00923323
Vues:
24
Thank you Mike,
I will try this some time this week.
To bad we did not see you at Devteach. I like to pay you a beer for this kind of help :).

>I think this will work for you. You can change the printer prompt by using the LECMDEXECOPT_DONTPROMPTUSER parameter.
>
>
#DEFINE OLECMDID_PRINT 6
>#DEFINE OLECMDEXECOPT_PROMPTUSER 1
>#DEFINE LECMDEXECOPT_DONTPROMPTUSER 2
>#DEFINE OLECMDF_SUPPORTED 1 &&Command is supported by this object.
>#DEFINE OLECMDF_ENABLED 2 &&Command is available and enabled.
>oBrowser=CREATEOBJECT("internetexplorer.application")
>oBrowser.Navigate2('www.levelextreme.com')
>DO WHILE oBrowser.QueryStatusWB(OLECMDID_PRINT) != (OLECMDF_SUPPORTED + OLECMDF_ENABLED)
>    DOEVENTS
>ENDDO
>oBrowser.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER)
>
>
>>This is what I am looking for.
>>
>>
>>ox=CREATEOBJECT('InternetExplorer.Application')
>>ox.navigate("C:\pdftest\InterVAC.htm")
>>* then someting like
>>ox.print() && which do not work
>>
>>
>>>Hi. I'm not sure whether you want to do it this way or whether the Autodesk plug-in will cause any issues vs. how this works with a standard html file, but does this work for you?
>>>
>>>
>>>TEXT TO xx
>>><html>
>>>Testing<br>1<br>2<br>3<br>
>>></html>
>>>ENDTEXT
>>>STRTOFILE( m.xx, "junk.html" )
>>>nResult = api_shellexecute( "junk.html", CURDIR(), "PRINT" )
>>>
>>>* Note - this is a proc that's been in my lib a few years and I think I lifted the code or at least the idea from the UT.
>>>PROCEDURE API_ShellExecute
>>>* WinApi :: ShellExecute
>>>**  Function: Opens a file in the application that it's
>>>**            associated with.
>>>**      Pass: lcFileName -  Name of the file to open
>>>**
>>>**  Return:   2  - Bad Association (e.g., invalid URL)
>>>**            31 - No application association
>>>**            29 - Failure to load application
>>>**            30 - Application is busy
>>>**
>>>**            Values over 32 indicate success
>>>**            and return an instance handle for
>>>**            the application started (e.g., the browser)
>>>LPARAMETERS tcFileName,tcWorkDir,tcOperation
>>>LOCAL lcFileName,lcWorkDir,lcOperation
>>>
>>>IF EMPTY ( tcFileName ) OR VARTYPE ( tcFileName ) <> "C"
>>>	RETURN -1
>>>ENDIF
>>>
>>>lcFileName  = ALLTRIM ( tcFileName )
>>>lcWorkDir   = IIF ( VARTYPE ( tcWorkDir ) = "C", ALLTRIM ( tcWorkDir ), "" )
>>>lcOperation = IIF ( VARTYPE ( tcOperation )= "C" AND NOT EMPTY ( tcOperation ), ;
>>>		ALLTRIM ( tcOperation ), "Open" )
>>>
>>>*-* HINSTANCE ShellExecute(hwnd, lpszOp, lpszFile, lpszParams, lpszDir, wShowCmd)
>>>*-*
>>>*-* HWND hwnd - handle of parent window
>>>*-* LPCTSTR lpszOp - address of string for operation to perform
>>>*-* LPCTSTR lpszFile - address of string for filename
>>>*-* LPTSTR lpszParams - address of string for executable-file parameters
>>>*-* LPCTSTR lpszDir - address of string for default directory
>>>*-* INT wShowCmd - whether file is shown when opened
>>>DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
>>>    INTEGER nWinHandle,;
>>>    STRING cOperation,;
>>>    STRING cFileName,;
>>>    STRING cParameters,;
>>>    STRING cDirectory,;
>>>    INTEGER nShowWindow
>>>
>>>RETURN ShellExecute ( 0, lcOperation, lcFilename, "", lcWorkDir, 1 )
>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform