An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn.

To send this message, call the SendMessage function with the following parameters.

  (HWND) hWnd,              
  (WPARAM) wParam,          
  (LPARAM) lParam            



The redraw state. If this parameter is TRUE, the content can be redrawn after a change. If this parameter is FALSE, the content cannot be redrawn after a change.


This parameter is not used.

Return value

An application returns zero if it processes this message.


This message can be useful if an application must add several items to a list box. The application can call this message with wParam set to FALSE, add the items, and then call the message again with wParam set to TRUE. Finally, the application can call RedrawWindow(hWnd, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN) to cause the list box to be repainted.


RedrawWindow with the specified flags is used instead of InvalidateRect because the former is necessary for some controls that have nonclient area on their own, or have window styles that cause them to be given a nonclient area (such as WS_THICKFRAME, WS_BORDER, or WS_EX_CLIENTEDGE). If the control does not have a nonclient area, RedrawWindow with these flags will do only as much invalidation as InvalidateRect would.


If the application sends the WM_SETREDRAW message to a hidden window, the window becomes visible (that is, the operating system adds the WS_VISIBLE style to the window).


Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Winuser.h (include Windows.h)

See also

Painting and Drawing Overview

Painting and Drawing Messages