Paint Structure

stores info about the window location, size

to define, use: 

     PAINTSTRUCT ps;

where:

typedef struct tagPAINTSTRUCT

{  HDC     hdc;                     // device context

    BOOL  fErase;                 // flags where app should redraw

    RECT   rcPaint;                // clipping area

    BOOL  fRestore;              // reserved

    BOOL  fIncUpdate;          // reserved

    BYTE  rgbReserved[32]; // reserved

} PAINTSTRUCT;

 

BOOL fErase – if this field is true user is responsible to repaint background (unless you specified a non-NULL background paint brush  ie: wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);)

 

RECT rcPaint – invalid region struct (.left, .top, .right, .bottom)

  only this area will be rendered

 

to draw in a larger area call:

    InvalidateRect(HWND  hWnd,   // win handle to invalidate 

                             CONST RECT  *lpRect, //ptr to invalid area

                             BOOL    bErase); //erase flag for BeginPaint()

 

if lpRect == NULL whole window will be invalid (can be drawn)

 

bErase – if you set to TRUE, next call to BeginPaint() redraws the background with current or default brush (destroying everything), else nothing is done to background.