Consultor Eletrônico



Kbase P6130: How to print the contents of an external file from a Progress 4GL program?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/15/2008
Status: Verified

GOAL:

How to print the contents of an external file from a Progress 4GL program?

GOAL:

How to print an HTML file from Progress 4GL?

GOAL:

How to print an image file with preview from Progress?

GOAL:

Progress 9.x

GOAL:

OpenEdge 10.x

FACT(s) (Environment):

Windows

FIX:

The code below uses the ShellExecuteA MS-Windows API function to print the contents of an external file such as a HTML document or image from a Progress 4GL program.

DEFINE VARIABLE viReturnCode AS INTEGER NO-UNDO.
DEFINE VARIABLE fileName AS CHARACTER NO-UNDO.
fileName = "c:\temp\SaveAsTest.htm":U.

RUN ShellExecuteA(0,
"print":U,
fileName,
"":U,
"":U,
0,
OUTPUT viReturnCode).

PROCEDURE ShellExecuteA EXTERNAL "shell32.dll":U:
/* Handle to parent window */
DEFINE INPUT PARAMETER plHWND AS LONG NO-UNDO.
/* Operation to perform: open, print */
DEFINE INPUT PARAMETER pcOperation AS CHARACTER NO-UNDO.
/* Document or executable name */
DEFINE INPUT PARAMETER pcFile AS CHARACTER NO-UNDO.
/* Command line parameters to executable in File */
DEFINE INPUT PARAMETER pcParameters AS CHARACTER NO-UNDO.
/* Default directory */
DEFINE INPUT PARAMETER pcDirectory AS CHARACTER NO-UNDO.
/* whether shown when opened:
0 hidden, 1 normal, minimized 2, maximized 3,
0 if File is a document */
DEFINE INPUT PARAMETER plShowCmd AS LONG NO-UNDO.
/* Return Code: less than or equal to 32 */
DEFINE RETURN PARAMETER plInstance AS LONG NO-UNDO.
END.