BOOL CXTPSkinObjectFrame::DrawMenuBar()
{
    m_dwStyle = m_dwExStyle = (DWORD)-1;

    UpdateButtons();

    UpdateMenuBar();

    RedrawFrame();

    return TRUE;
}
// WM_SYSCOMMAND handler
//  We need to handle SC_MAXIMIZE to avoid any border leakage
BOOL cef_dark_aero_window::HandleSysCommand(UINT command)
{
    if ((command & 0xFFF0) != SC_MAXIMIZE)
        return FALSE;

    // Aero windows still get a border when maximized
    //  The border, however, is the size of the unmaximized 
    //  window. To obviate that border we turn off drawing and 
    //  set the size of the window to zero then maximize the window
    //  and redraw the window.  
    //
    // This creates a new problem: the restored window size is now
    //  0 which, when actually restored, is the size returned from 
    //  the WM_GETMINMAXINFO handler. To obviate that problem we get
    //  the window's restore size before maximizing it and reset it after.

    WINDOWPLACEMENT wp;
    ::ZeroMemory(&wp, sizeof (wp));

    wp.length = sizeof(WINDOWPLACEMENT);
    GetWindowPlacement(&wp);

    SetRedraw(FALSE);
    SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOACTIVATE);
    DefaultWindowProc(WM_SYSCOMMAND, command, 0L);
    SetRedraw(TRUE);

    UpdateMenuBar();

    wp.flags            = 0;
    wp.showCmd          = SW_MAXIMIZE;

    wp.ptMinPosition.x  = -1;
    wp.ptMinPosition.y  = -1;
    wp.ptMaxPosition.x  = -1;
    wp.ptMaxPosition.y  = -1;

    // reset the restore size
    SetWindowPlacement(&wp);
    return TRUE;
}
// WindowProc handles dispatching of messages and routing back to the base class or to Windows
LRESULT cef_dark_aero_window::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
    bool callDefWindowProc = true;

    switch (message) 
    {

    case WM_MEASUREITEM:
        if (HandleMeasureItem((LPMEASUREITEMSTRUCT)lParam))
            return 0L;
        break;
    case WM_DRAWITEM:
        if (HandleDrawItem((LPDRAWITEMSTRUCT)lParam))
            return 0L;
        break;
    case WM_SETICON:
        mWindowIcon = 0;
        {
            RECT rectIcon;
            ComputeWindowIconRect(rectIcon);
            InvalidateRect(&rectIcon);
        }
        break;
    }

    // First let the DesktopWindowManager handler the message and tell us if 
    //  we should pass the message to the default window proc
    LRESULT lr = DwpCustomFrameProc(message, wParam, lParam, &callDefWindowProc);

    switch(message) {
    case WM_SYSCOMMAND:
        if (HandleSysCommand((UINT)wParam)) 
            return 0L;
        break;
    case WM_ACTIVATE:
        if (mReady) {
            UpdateMenuBar();
        }
        break;
    case WM_NCMOUSELEAVE:
        // NOTE: We want anyone else interested in this message
        //          to be notified. Otherwise the default implementation 
        //          may be in the wrong state
        HandleNcMouseLeave();
        break;
    case WM_NCMOUSEMOVE:
        {
            POINT pt;
            POINTSTOPOINT(pt, lParam);

            if (HandleNcMouseMove((UINT)wParam, &pt))
                return 0L;
        }
        break;
    case WM_NCLBUTTONDOWN:
        {
            POINT pt;
            POINTSTOPOINT(pt, lParam);
            if (HandleNcLeftButtonDown((UINT)wParam, &pt))
                return 0L;
        }
        break;
    case WM_NCLBUTTONUP:
        {
            POINT pt;
            POINTSTOPOINT(pt, lParam);
            if (HandleNcLeftButtonUp((UINT)wParam, &pt))
                return 0L;
        }
        break;
    }

    // call DefWindowProc?
    if (!callDefWindowProc) {
        return lr;
    }


    lr = cef_window::WindowProc(message, wParam, lParam);

    if (!mReady)
        return lr;

    switch (message)
    {
    case WM_SETTEXT:
    case WM_WINDOWPOSCHANGING:
    case WM_WINDOWPOSCHANGED:
    case WM_MOVE:
    case WM_SIZE:
    case WM_SIZING:
    case WM_EXITSIZEMOVE:
        UpdateNonClientArea();
        if (message == WM_WINDOWPOSCHANGED) 
        {
            RECT rect;
            ComputeMenuBarRect(rect);
            InvalidateRect(&rect, TRUE);
        }
        break;
    case WM_EXITMENULOOP:
        mMenuActiveIndex = -1;
        break;   
    }

    return lr;
}