Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change console window style at runtime?

I'm making a game in console application and I want to prevent user resizing and maximizing window. How can I do this using HWND?

like image 588
Ovidzikas Avatar asked Dec 21 '25 23:12

Ovidzikas


1 Answers

I found solution. This code will disable window Size and Maximize box:

HWND consoleWindow = GetConsoleWindow();
SetWindowLong(consoleWindow, GWL_STYLE, GetWindowLong(consoleWindow, GWL_STYLE) & ~WS_MAXIMIZEBOX & ~WS_SIZEBOX);
like image 176
Ovidzikas Avatar answered Dec 24 '25 17:12

Ovidzikas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!