[SHELL32] CMenuDeskBar: Prevent destruction of the start menu when receiving a WM_CLO...
[reactos.git] / reactos / dll / win32 / shell32 / shellmenu / CMenuDeskBar.cpp
index 95fad3c..9b63fed 100644 (file)
@@ -817,6 +817,34 @@ LRESULT CMenuDeskBar::_OnWinIniChange(UINT uMsg, WPARAM wParam, LPARAM lParam, B
     return 0;
 }
 
+LRESULT CMenuDeskBar::_OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+    /* If it is a flat style menu we need to handle WM_NCPAINT 
+     * and paint the border with the right colour */
+    if ((GetStyle() & WS_BORDER) == 0)
+    {
+        /* This isn't a flat style menu. */
+        bHandled = FALSE;
+        return 0;
+    }
+
+    HDC hdc;
+    RECT rcWindow;
+
+    hdc = GetWindowDC();
+    GetWindowRect(&rcWindow);
+    OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top);
+    FrameRect(hdc, &rcWindow, GetSysColorBrush(COLOR_BTNSHADOW));
+    ReleaseDC(hdc);
+    return 0;
+}
+
+LRESULT CMenuDeskBar::_OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+    /* Prevent the CMenuDeskBar from destroying on being sent a WM_CLOSE */
+    return 0;
+}
+
 HRESULT CMenuDeskBar::_AdjustForTheme(BOOL bFlatStyle)
 {
     DWORD style = bFlatStyle ? WS_BORDER : WS_CLIPCHILDREN|WS_DLGFRAME;