Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I have IE print from VFP
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00922610
Message ID:
00922643
Views:
22
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 )
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform