The shadow around the window disappears when the window is maximized

帅天 谭 6 Reputation points
2021-06-07T03:00:02.753+00:00

As we all know, the window will occupy the whole screen when maximized in normal circumstances. However, I captured message "WM_GETMINMAXINFO" and modify window's rectangle size and position when maximizing the window, therefore it doesn't fill the entire screen.
Now here's the problem, the shadow around the window disappeared! I don't know if this is the default processing of windows system. If it is, how can I make the shadow reappear.
By the way, I add window shadow through DWM as follows:
DwmEnableComposition(DWM_EC_ENABLECOMPOSITION);
const MARGINS shadow = { 1, 0, 0, 0 };
DwmExtendFrameIntoClientArea(HWND(winId()), &shadow);

Could you please help me about this question? Thank you very much.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,626 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 12,726 Reputation points Microsoft Vendor
    2021-06-23T09:45:14.003+00:00

    As far as I am concerned, with DWM, It is necessary to recalculate the non-client area after the window is maximized. You can refer to the custom-chrome GitHub Project for more details.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.