I have a small application, where you can set, if maximize or minimize button is active or not/grayed out.
if (!m_bActiveMaximizeButton) // Maximieren
{
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) // Minimieren
{
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) // Schließen X
{
menue->ModifyMenu(SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
} else
{
menue->ModifyMenu(SC_CLOSE, static_cast<UINT>(MF_BYCOMMAND | ~MF_GRAYED));
}
This works fine with Windows 7 styles. However, with Windows 10 styles, the buttons do not gray out, but they disappear completely. Deactivating the "Close" button does not work at all anymore.
What do I have to change to gray out the buttons again?