I want to disable the console window's maximize button, resize by drag, and X button in a C++ program.
But it doesn't work with this code:
#include <iostream>
#include <Windows.h>
using namespace std;
int main(void)
{
DeleteMenu(GetSystemMenu(GetConsoleWindow(), FALSE), SC_MAXIMIZE, MF_GRAYED); // maximize button
EnableMenuItem(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE, MF_GRAYED); // X button
DrawMenuBar(GetConsoleWindow());
return 0;
}
I remember this worked on Windows 10.
Is this a Windows 11 problem, or is there another way to solve it?
Refer to the Blog:Windows Terminal is now the Default in Windows 11
On win10, the default terminal is Windows Console Host
. I suggest you could set the default terminal to Windows Console Host
in win11.
Settings -> System -> For developers -> Terminal