Kbase 20708: How to Force a Progress Window to be Repainted on Entry.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  05/02/2008 |
|
Status: Unverified
GOAL:
How to force a progress window to be repainted on entry.
FIX:
/*The code involves an entry trigger that makes three API function calls that force the repainting of the progress object. In this example we will assume that our progress object is a frame widget. */
THE TRIGGER:
============
ON ENTRY OF FRAME FrameName ANYWHERE
DO:
DEFINE VARIABLE intHwnd AS INTEGER NO-UNDO.
DEFINE VARIABLE intlpRect AS INTEGER NO-UNDO.
DEFINE VARIABLE intbErase AS INTEGER NO-UNDO.
DEFINE VARIABLE intResult AS INTEGER NO-UNDO.
RUN FindWindowA(0, CURRENT-WINDOW:TITLE, OUTPUT intHwnd).
RUN InvalidateRect(intHwnd, 0 , 1, OUTPUT intResult).
RUN UpdateWindow(intHwnd, OUTPUT intResult).
RETURN.
END.
THE API FUNCTIONS:
==================
/* The FindWindowA API returns the handle of the progress object */
PROCEDURE FindWindowA EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER intClassName AS LONG.
DEFINE INPUT PARAMETER intCaption AS CHARACTER.
DEFINE RETURN PARAMETER intHwnd AS LONG.
END PROCEDURE.
/* The InvalidateRect API defines the area that must be repainted */
PROCEDURE InvalidateRect EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER intHwnd AS LONG.
DEFINE INPUT PARAMETER intlpRect AS LONG.
DEFINE INPUT PARAMETER intbErase AS LONG.
DEFINE RETURN PARAMETER intResult AS LONG.
END PROCEDURE.
/* The UpdateWindow API forces the immediate painting of the window */
PROCEDURE UpdateWindow EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER intHwnd AS LONG.
DEFINE RETURN PARAMETER intResult AS LONG.
END PROCEDURE.