My understanding was that LockWindowUpdate(<window handle>) locked that window and all it's child windows. This may fail if another window is currently locked. If you don't test the return value and the lock failed because another window was already locked then you will not be unlocking (LockWindowUpdate(0) to unlock) the window that you think you are.
Guy ----------------------- >From MSDN: LockWindowUpdate The LockWindowUpdate function disables or enables drawing in the specified window. Only one window can be locked at a time. BOOL LockWindowUpdate( HWND hWndLock // handle to window ); Parameters hWndLock [in] Specifies the window in which drawing will be disabled. If this parameter is NULL, drawing in the locked window is enabled. Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero, indicating that an error occurred or another window was already locked. Windows NT/2000/XP: To get extended error information, call GetLastError. Remarks If an application with a locked window (or any locked child windows) calls the GetDC, GetDCEx, or BeginPaint function, the called function returns a device context with a visible region that is empty. This will occur until the application unlocks the window by calling LockWindowUpdate, specifying a value of NULL for hWndLock. If an application attempts to draw within a locked window, the system records the extent of the attempted operation in a bounding rectangle. When the window is unlocked, the system invalidates the area within this bounding rectangle, forcing an eventual WM_PAINT message to be sent to the previously locked window and its child windows. If no drawing has occurred while the window updates were locked, no area is invalidated. LockWindowUpdate does not make the specified window invisible and does not clear the WS_VISIBLE style bit. A locked window cannot be moved. Requirements Windows NT/2000/XP: Included in Windows NT 3.1 and later. Windows 95/98/Me: Included in Windows 95 and later. Header: Declared in Winuser.h; include Windows.h. Library: Use User32.lib. -----Original Message----- From: Nello Sestini [mailto:[EMAIL PROTECTED]] I could be remembering this wrong - but ISTR that even passing a handle to a particular window cause side effects elsewhere. I'm sure I wasn't locking the desktop (well ... pretty sure <g> ) ----- Original Message ----- From: "Myles Penlington" <[EMAIL PROTECTED]> > Yep, If you pass it handle 0, then it locks the desktop, so everything gets > locked ... > Myles. --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/