In Windows 10, a console app can be switched to a full-screen mode by pressing F11 or Alt+Enter. Note that this is not your grandfather's text-only VGA full-screen mode that was supported before Windows Vista. Although there is no task-bar or title bar visible in this mode, other windows (or Start menu) can pop up on top of it, and it is part of Windows GUI.
I have a .NET Core / C# console app running on Windows 10. When I need to switch it to a full-screen mode, I use P/Invoke to send a F11 keystroke to my own window after bringing it to foreground. Obviously, it does not do what I want if the app has been already switched to a full-screen mode manually before, but I can try to work around it by doing some computations with the window size to detect it.
I am looking for a less round-about way to do it. I would like to know:
bool isFullScreen()
{
return Console.WindowWidth ==Console.LargestWindowWidth && Console.WindowHeight == Console.LargestWindowHeight;
}
Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
I am looking for a less round-about way to do it Since full-screen is a feature of GUI layer, trying to use it with console applications will always be kind of round-about
While the other answer describes, how you can run it, in most cases if you need full screen I'd consider creating your own window app (WPF? UWP?) with consolish interface. This way you can fully control the screen, block exiting it etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With