what's wrong with my progress procedure?

cywong119

New Member
Dear All,

I create a progress procedure called myprog.p. My procedure is to run a external program in progress procedure. When I try to run this programm, it prompt error. I am not very familiar with progress 4GL program.

what's wrong with my progress procedure? I have no idea. Could anyone advise me?

The progress procedure is as follows:

/*Begin of My procedure*/
def shared var Cur-Comp as Character format "x(8)" no-undo.

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.

/* Now enable the interface and wait for the exit condition. */
/* (NOTE: handle ERROR and END-KEY so cleanup code will always fire. */
MAIN-BLOCK:
DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
/* ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK: */
RUN ShellExecuteA
(0,
"open",
U:\Report\SOReport.exe,
Cur-Comp,
"",
1,
OUTPUT viReturnCode).

/* IF NOT THIS-PROCEDURE:PERSISTENT THEN
WAIT-FOR CLOSE OF THIS-PROCEDURE.*/
END.
/*end of procedure*/

Christine
 
Hi Christine,

Just a couple of things I can see.


1. You need to define variable viReturnCode:

Code:
DEF VAR viReturnCode AS INT NO-UNDO.

2. pcFile parameter should be a quoted string:

Code:
RUN ShellExecuteA (0, "open", "U:\Report\SOReport.exe",
		Cur-Comp, "", 1, OUTPUT viReturnCode).
 
Back
Top