InvalidateRect The InvalidateRect function adds a rectangle to the specified window's update region. The update region represents the portion of the window's client area that must be redrawn. BOOL InvalidateRect( HWND hWnd, // handle to window CONST RECT* lpRect, // rectangle coordinates BOOL bErase // erase state ); Parameters hWnd [in] Handle to the window whose update region has changed. If this parameter is NULL, the system invalidates and redraws all windows, and sends the WM_ERASEBKGND and WM_NCPAINT messages to the window procedure before the function returns. lpRect [in] Pointer to a RECT structure that contains the client coordinates of the rectangle to be added to the update region. If this parameter is NULL, the entire client area is added to the update region. bErase [in] Specifies whether the background within the update region is to be erased when the update region is processed. If this parameter is TRUE, the background is erased when the BeginPaint function is called. If this parameter is FALSE, the background remains unchanged. Return Values If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. Windows NT/2000/XP: To get extended error information, call GetLastError.
1不是0,代表True。
The InvalidateRect function adds a rectangle to the specified window's update region. The update region represents the portion of the window's client area that must be redrawn. BOOL InvalidateRect(
HWND hWnd, // handle to window
CONST RECT* lpRect, // rectangle coordinates
BOOL bErase // erase state
);
Parameters
hWnd
[in] Handle to the window whose update region has changed. If this parameter is NULL, the system invalidates and redraws all windows, and sends the WM_ERASEBKGND and WM_NCPAINT messages to the window procedure before the function returns.
lpRect
[in] Pointer to a RECT structure that contains the client coordinates of the rectangle to be added to the update region. If this parameter is NULL, the entire client area is added to the update region.
bErase
[in] Specifies whether the background within the update region is to be erased when the update region is processed. If this parameter is TRUE, the background is erased when the BeginPaint function is called. If this parameter is FALSE, the background remains unchanged.
Return Values
If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. Windows NT/2000/XP: To get extended error information, call GetLastError.
CRect m_rect;
ClientToScreen(&rect)
然后InvalidateRect(hwnd,&rect,1);