You send 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.
SendMessage( (HWND) hWnd, WM_SETREDRAW, (WPARAM) wParam, (LPARAM) lParam );
The redraw state. If this parameter is TRUE, then the content can be redrawn after a change. If this parameter is FALSE, then the content can't be redrawn after a change.
This parameter isn't used.
Your application should return 0 if it processes this message.
This message can be useful if your application must add several items to a list box. Your 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, your application can call RedrawWindow(hWnd, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN) to cause the list box to be repainted.
You should use RedrawWindow with the specified flags, instead of InvalidateRect, because the former is necessary for some controls that have nonclient area of 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, then RedrawWindow with these flags will do only as much invalidation as InvalidateRect would.
Passing a WM_SETREDRAW message to the DefWindowProc function removes the WS_VISIBLE style from the window when wParam is set to FALSE. Although the window content remains visible on screen, the IsWindowVisible function returns FALSE when called on a window in this state.
Passing a WM_SETREDRAW message to the DefWindowProc function adds the WS_VISIBLE style to the window, if not set, when wParam is set to TRUE. If your application sends the WM_SETREDRAW message with wParam set to TRUE to a hidden window, then the window becomes visible.
Windows 10 and later; Windows Server 2016 and later. The system sets a property named SysSetRedraw on a window whose window procedure passes WM_SETREDRAW messages to DefWindowProc. You can use the GetProp function to get the property value when it's available. GetProp returns a non-zero value when redraw is disabled. GetProp will return zero when redraw is enabled, or when the window property doesn't exist.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|