Page 1 of 1

Forbidding console resize?

Posted: Tue Jan 30, 2024 2:23 pm
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...?).

Re: Forbidding console resize?

Posted: Tue Jan 30, 2024 2:33 pm
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.

Re: Forbidding console resize?

Posted: Tue Jan 30, 2024 4:17 pm
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

Re: Forbidding console resize?

Posted: Tue Jan 30, 2024 4:33 pm
by Joubarbe
Thanks! :)