Consultor Eletrônico



Kbase P113619: How to Call WIN32 API Function: LockWindowUpdate
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   9/25/2008
Status: Verified

GOAL:

How to Call WIN32 API Function: LockWindowUpdate

FACT(s) (Environment):

Windows
Progress 8.x
Progress 9.x
OpenEdge 10.x
OpenEdge Category: Language (4GL/ABL)

FIX:

The following sample code shows how to call the Win32 API function called LockWindowUpdate.

This function temporarily disables updates within the specified window. Only one window can be locked at one time. While a window is locked, Windows discards any drawing done in a device context associated with the window. Windows does accumulate a bounding rectangle of any drawing that is done. Once the window is unlocked, Windows invalidates the accumulated rectangle, which will eventually cause a WM_PAINT message to be sent to the window. To unlock the window, specify a value of NULL (zero) for the window handle.This function returns the UserID used to logon to Windows.

This code has been tested on Windows NT 4.0 Workstation only.
DEFINE VARIABLE iRC AS INTEGER NO-UNDO.

PROCEDURE LockWindowUpdate EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER iWindowHwnd AS LONG NO-UNDO.
DEFINE RETURN PARAMETER iResult AS LONG NO-UNDO.
END PROCEDURE.

/* assume window has been defined and created at this point */

RUN LockWindowUpdate (INPUT {&WINDOW-NAME}:HWND, OUTPUT iRC).

IF iRC = 0 THEN
DO:
MESSAGE "Lock of Window Failed" VIEW-AS ALERT-BOX.
RETURN.
END.

/* lots of window manipulation happens at this point */

RUN LockWindowUpdate (INPUT 0, OUTPUT iRC).

IF iRC = 0 THEN
DO:
MESSAGE "Unlock of Window Failed" VIEW-AS ALERT-BOX.
RETURN.
END.