This function is useful to threads that need to prevent window visible regions from changing while some screen operation, such as copying screen pels into a memory bit map, is being performed.

Any other thread that tries to alter the visible regions is blocked while the visible regions are locked. While the visible regions are locked, no messages must be sent and no functions called that can send messages.

Only one thread can lock the visible regions at any one time. The same thread can call WinLockVisRegions multiple times. A lock count is maintained by the system and is incremented each time a locking call is made, and decremented each time an unlocking call is made. The visible regions are unlocked when the count is zero.

Note: Locking the visible regions does not prevent painting of a window by another process.