Forbidding console resize?

Just starting out? Need help? Post your questions and find answers here.
Joubarbe
Enthusiast
Enthusiast
Posts: 714
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Forbidding console resize?

Post by Joubarbe »

Is it possible to deactivate resize and maximize gadgets on the Windows console?

I saw this C# solution, but not sure what to do with it (_DeleteMenu doesn't seem to be recognised...?).
User avatar
jacdelad
Addict
Addict
Posts: 2032
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Forbidding console resize?

Post by jacdelad »

I can't help you with that, but:
With all these questions about the console lately: It is not designed to be used like a normal window. It is just for spitting out infos and letting other program read them and such. If you need a console with fixed size you better create your own simple one.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
GoodNPlenty
Enthusiast
Enthusiast
Posts: 112
Joined: Wed May 13, 2009 8:38 am
Location: Arizona, USA

Re: Forbidding console resize?

Post by GoodNPlenty »

This should work.

Code: Select all

Import ""
  GetConsoleWindow()
EndImport

If OpenConsole()
  hndWnd = GetConsoleWindow()
  DeleteMenu_(GetSystemMenu_(hndWnd, #False), #SC_CLOSE, #MF_BYCOMMAND)
  DeleteMenu_(GetSystemMenu_(hndWnd, #False), #SC_MINIMIZE, #MF_BYCOMMAND)
  DeleteMenu_(GetSystemMenu_(hndWnd, #False), #SC_MAXIMIZE, #MF_BYCOMMAND)
  DeleteMenu_(GetSystemMenu_(hndWnd, #False), #SC_SIZE, #MF_BYCOMMAND)
  PrintN("Enter to Close")
  Input()
EndIf
Joubarbe
Enthusiast
Enthusiast
Posts: 714
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: Forbidding console resize?

Post by Joubarbe »

Thanks! :)
Post Reply