-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disable console screen resizing #33
Comments
alternatively, see if we can simply have this value unchecked as part of the console app setting. This is new BTW and has only been added in windows 10. |
blows me away that this is not available in .net ? BOOL WINAPI SetConsoleMode(
_In_ HANDLE hConsoleHandle,
_In_ DWORD dwMode
); Grrr, just reading more, there is an enticingly almost right setting that does text wrapping, but that's only for when text is being written, and does not impact when the screen is resized, so this does not look like it helps! hashtag redherring. |
Quick update : @eiredrake has confirmed in closed issue #28 that adding the following code does stop a console app from being resized; That looks like a plausible option, just need a nice .net core (.net standard) way to deliver this with the nuget package. class Program
{
private const int MF_BYCOMMAND = 0x00000000;
public const int SC_CLOSE = 0xF060;
public const int SC_MINIMIZE = 0xF020;
public const int SC_MAXIMIZE = 0xF030;
public const int SC_SIZE = 0xF000;
[DllImport("user32.dll")]
public static extern int DeleteMenu(IntPtr hMenu, int nPosition, int wFlags);
[DllImport("user32.dll")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("kernel32.dll", ExactSpelling = true)]
private static extern IntPtr GetConsoleWindow();
static void Main(string[] args)
{
IntPtr handle = GetConsoleWindow();
IntPtr sysMenu = GetSystemMenu(handle, false);
if (handle != IntPtr.Zero)
{
DeleteMenu(sysMenu, SC_CLOSE, MF_BYCOMMAND);
DeleteMenu(sysMenu, SC_MINIMIZE, MF_BYCOMMAND);
DeleteMenu(sysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
DeleteMenu(sysMenu, SC_SIZE, MF_BYCOMMAND);
}
Console.Read();
}
} |
Interesting. I'll poke that now. Yep... that prevents it from going wacky. very cool. |
@eiredrake Just released version |
When running a console executable in windows, if you resize the console window while the app is running it totally wrecks the layout. Like below ... (this is not a bug with Konsole, it's a behavior of windows consoles, there's a checkbox setting in options, that is on by default to "wrap text on resize". ) Using platform detection it might be possible to provide a switch to lock the window from being resized. Alternatively, launch a custom console emulator? This issue goes hand in hand with issue #32 as a core requirement for Konsole to be able to be used to build commercial applications and utilities. If the speed of Konsole can be dramatically improved, then detecting resize and offering a Redraw facility similar to Winforms then becomes a realistic option.
The text was updated successfully, but these errors were encountered: