// Like UpdateNonClientArea, but sets up a clipping region to just update the system buttons
void cef_dark_window::UpdateNonClientButtons () 
{
    // create a simple clipping region
    //  that only includes the system buttons (min/max/restore/close)
    HDC hdc = GetWindowDC();

    RECT rectCloseButton ;
    ComputeCloseButtonRect (rectCloseButton) ;
 
    RECT rectMaximizeButton ;
    ComputeMaximizeButtonRect (rectMaximizeButton) ;
 
    RECT rectMinimizeButton ;
    ComputeMinimizeButtonRect (rectMinimizeButton) ;

    RECT rectWindow ;
    ComputeLogicalWindowRect (rectWindow) ;
    ::ExcludeClipRect (hdc, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom);

    RECT rectButtons;
    rectButtons.top = rectCloseButton.top;
    rectButtons.right = rectCloseButton.right;
    rectButtons.bottom = rectCloseButton.bottom;
    rectButtons.left = rectMinimizeButton.left;

    HRGN hrgnUpdate = ::CreateRectRgnIndirect(&rectButtons);

    if (::SelectClipRgn(hdc, hrgnUpdate) != NULLREGION) {
        DoPaintNonClientArea(hdc);
    }

    ::DeleteObject(hrgnUpdate);
    ReleaseDC(hdc);
}
// WM_PAINT handler
//  since we're extending the client area into the non-client
//  area, we have to draw all of the non-clinet stuff during
//  WM_PAINT
BOOL cef_dark_aero_window::HandlePaint()
{
    PAINTSTRUCT ps;
    HDC hdc = BeginPaint(&ps);
    DoPaintNonClientArea(hdc);
    EndPaint(&ps);
    return TRUE;
}
// WM_NCPAINT handler
BOOL cef_dark_window::HandleNcPaint(HRGN hUpdateRegion)
{
    HDC hdc = GetDCEx(hUpdateRegion, DCX_WINDOW|DCX_INTERSECTRGN|DCX_USESTYLE);
    DoPaintNonClientArea(hdc);
    ReleaseDC(hdc);

    return TRUE;
}
// Force Drawing the non-client area.
//  Normally WM_NCPAINT is used but there are times when you
//  need to force drawing the entire non-client area when
//  legacy windows message handlers start drawing non-client
//  artifacts over top of us
void cef_dark_aero_window::UpdateNonClientArea()
{
	if (CanUseAeroGlass()) {
        HDC hdc = GetDC();
        DoPaintNonClientArea(hdc);
        ReleaseDC(hdc);
    } else {
        cef_dark_window::UpdateNonClientArea();
    }
}
// Force Drawing the non-client area.
//  Normally WM_NCPAINT is used but there are times when you
//  need to force drawing the entire non-client area when
//  legacy windows message handlers start drawing non-client
//  artifacts over top of us
void cef_dark_window::UpdateNonClientArea()
{
    HDC hdc = GetWindowDC();
    DoPaintNonClientArea(hdc);
    ReleaseDC(hdc);
}