Consultor Eletrônico



Kbase P112583: How to interrupt with 4GL a document printing in word
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   1/16/2006
Status: Unverified

GOAL:

How to interrupt with 4GL a document printing in word

GOAL:

How to use PROCESS EVENTS to interrupt a document printing with Word.

FIX:


DEFINE VARIABLE lStop AS LOGICAL NO-UNDO INITIAL FALSE.
DEF BUTTON bRun LABEL "Print".
DEF BUTTON bCancel LABEL "Cancel Print".
DEF FRAME f-1 bRun bCancel.
ENABLE ALL WITH FRAME f-1.

ON 'CHOOSE':U OF bCancel lSTOP = TRUE.
ON 'choose':U OF bRun
DO:
DEFINE VARIABLE chWord as COM-HANDLE NO-UNDO.
DEFINE VARIABLE chDoc AS COM-HANDLE NO-UNDO.

CREATE "word.application" chWord. /* Hide Microsoft Word */

chWord:visible = false.

/* Open the document */
chDoc = chWord:documents:open("E:\Word.doc").

/* Print the document */
chDoc:printout.
ETIME(TRUE).

REPEAT:
IF lStop THEN LEAVE.

PROCESS EVENTS.
END.
/* Quit Word */
chword:quit().
RELEASE OBJECT chDoc.
RELEASE OBJECT chWord.
END.
WAIT-FOR CHOOSE OF bRun.