Jump to content

WinLockWindowUpdate: Difference between revisions

From EDM2
No edit summary
 
Line 1: Line 1:
This function disables or enables output to a window and its descendants.
This function disables or enables output to a window and its descendants.


==Syntax==
== Syntax ==
WinLockWindowUpdate(hwndDeskTop, hwndLockUpdate)
<pre>
WinLockWindowUpdate(hwndDeskTop, hwndLockUpdate);
</pre>


==Parameter==
== Parameters ==
;hwndDeskTop (HWND) - input: Desktop handle of the screen containing the window to be locked.
;''hwndDeskTop'' ([[HWND]]) - input: Desktop handle of the screen containing the window to be locked.
;hwndLockUpdate (HWND)) - input: Handle of window in which output is to be prevented.
:HWND_DESKTOP: The desktop-window handle.
:Other: Specified desktop-window handle.


==Returns==
;''hwndLockUpdate'' ([[HWND]]) - input: Handle of window in which output is to be prevented.
;rc ([[BOOL]]) - return: Success indicator.
:NULLHANDLE: Enable output in the locked window and its descendants.
:Other: Handle of the window in which output is to be prevented. Output is also prevented in the descendants of the window.
 
== Returns ==
;''rc'' ([[BOOL]]) - returns: Success indicator.
:TRUE: Successful operation.
:FALSE: Error occurred.
 
== Remarks ==
This function is used by threads that need to draw on an area of the screen over which they have no control. For example, the user interface sizing and moving calls use this call when drawing the shadow box, as a window is sized or moved.
 
All threads continue to run while the window is disabled; only output is prevented.
 
If one thread disables the window, other threads using this function are blocked until the first enables the window, although they can still receive messages.
 
This function does not prevent screen group switches, because these may be necessary to handle "hard errors" in other screen groups.
 
== Example Code ==
Declaration:
<pre>
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>
 
HWND     hwndDeskTop;      /*  Desktop handle of the screen containing the window to be locked. */
HWND     hwndLockUpdate;   /*  Handle of window in which output is to be prevented. */
BOOL     rc;              /*  Success indicator. */
 
rc = WinLockWindowUpdate(hwndDeskTop, hwndLockUpdate);
</pre>
 
This example disables output to a window and its children during a move operation (WM_MOVE) and then re-enables output once the move is finished.
<pre>
#define INCL_WINWINDOWMGR       /* Window Manager Functions     */
#include <os2.h>
 
HWND  hwndLock;         /* handle of window to be (un)locked    */
BOOL  fSuccess;         /* success indicator                    */
 
case WM_MOVE:
     /* lock output */
     fSuccess = WinLockWindowUpdate(HWND_DESKTOP, hwndLock);
 
     /*
      .
      . execute window move
      .
      */
 
     /* unlock output */
     fSuccess = WinLockWindowUpdate(HWND_DESKTOP, NULLHANDLE);
</pre>


[[Category:Win]]
[[Category:Win]]
[[Category:WorkToDo]]

Latest revision as of 15:58, 15 May 2025

This function disables or enables output to a window and its descendants.

Syntax

WinLockWindowUpdate(hwndDeskTop, hwndLockUpdate);

Parameters

hwndDeskTop (HWND) - input
Desktop handle of the screen containing the window to be locked.
HWND_DESKTOP: The desktop-window handle.
Other: Specified desktop-window handle.
hwndLockUpdate (HWND) - input
Handle of window in which output is to be prevented.
NULLHANDLE: Enable output in the locked window and its descendants.
Other: Handle of the window in which output is to be prevented. Output is also prevented in the descendants of the window.

Returns

rc (BOOL) - returns
Success indicator.
TRUE: Successful operation.
FALSE: Error occurred.

Remarks

This function is used by threads that need to draw on an area of the screen over which they have no control. For example, the user interface sizing and moving calls use this call when drawing the shadow box, as a window is sized or moved.

All threads continue to run while the window is disabled; only output is prevented.

If one thread disables the window, other threads using this function are blocked until the first enables the window, although they can still receive messages.

This function does not prevent screen group switches, because these may be necessary to handle "hard errors" in other screen groups.

Example Code

Declaration:

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND     hwndDeskTop;      /*  Desktop handle of the screen containing the window to be locked. */
HWND     hwndLockUpdate;   /*  Handle of window in which output is to be prevented. */
BOOL     rc;              /*  Success indicator. */

rc = WinLockWindowUpdate(hwndDeskTop, hwndLockUpdate);

This example disables output to a window and its children during a move operation (WM_MOVE) and then re-enables output once the move is finished.

#define INCL_WINWINDOWMGR       /* Window Manager Functions     */
#include <os2.h>

HWND  hwndLock;         /* handle of window to be (un)locked    */
BOOL  fSuccess;         /* success indicator                    */

case WM_MOVE:
     /* lock output */
     fSuccess = WinLockWindowUpdate(HWND_DESKTOP, hwndLock);

     /*
      .
      . execute window move
      .
      */

     /* unlock output */
     fSuccess = WinLockWindowUpdate(HWND_DESKTOP, NULLHANDLE);