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:
- How do I check from a console app whether it is currently in a full-screen mode?
- How do I switch my console app to and from a full-screen mode?