Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I hope anybody can help me.

I my application, you can deactivate the maximize/minimize/close button of custom windows.

In Window10 look an feel my code does not work anymore like in windows 7.

The buttons maximize and minimize do not gray out anymore, they disappear.
And deactivating the close button has no effect anymore.

What do I have to change to get the same behavior again?
Is there a way to still gray them out?


Thank you in advance

What I have tried:

if (!m_bActiveMaximizeButton)  
{
    this->ModifyStyle(WS_CAPTION|WS_MAXIMIZEBOX,0,0);
    this->ModifyStyle(0,WS_CAPTION,SWP_FRAMECHANGED);       
} else
{
    this->ModifyStyle(WS_CAPTION,0,0);
    this->ModifyStyle(0,WS_CAPTION,SWP_FRAMECHANGED);
}
if (!m_bActiveMinimizeButton)  
{
    this->ModifyStyle(WS_CAPTION|WS_MINIMIZEBOX,0,0);
    this->ModifyStyle(0,WS_CAPTION,SWP_FRAMECHANGED);
} else
{
    this->ModifyStyle(WS_CAPTION,0,0);
    this->ModifyStyle(0,WS_CAPTION,SWP_FRAMECHANGED);
}
    CMenu* menue = this->GetSystemMenu(FALSE);

if (!m_bActiveCloseButton)  
{
    menue->ModifyMenu(SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
} else
{
    menue->ModifyMenu(SC_CLOSE, static_cast<UINT>(MF_BYCOMMAND | ~MF_GRAYED));
}
Posted
Updated 5-Sep-21 21:00pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900