RECT re; GetClientRect(&re); CRect rect(re); HRESULT hr = InvalidateRect(NULL, TRUE); if ( hr != S_OK ) ....; else ....;