This is my paint function.
Code:
int RePaint(HWND hWnd)
{
    RECT        theRect;
    PAINTSTRUC  ps;

GetUpdateRect(hWnd, &theRect, 0);
if (IsRectEmpty(&theRect))
{
      GetClientRect(hWnd,&theRect);
}
BeginPaint(hWnd, &ps);
BitBlt(ps.hdc, theRect.left, theRect.top, theRect.right - theRect.left, theRect.bottom - theRect.top, 
       hdcFrameBuffer, theRect.left, theRect.top, SRCCOPY);
EndPaint(hWnd, &ps);