0

I want to fullscreen console as if you would press Alt+Enter. The only thing somewhat close to what I want is something like this, except it maximizes it, not fullscreen.

How would the code for that look?

Emond
  • 50,210
  • 11
  • 84
  • 115
  • 1
    One of the the answers in the question you linked allows you to maximize the console. Isn't that what you are asking for? If not, why not? – Emond Mar 05 '18 at 19:40
  • As said, I want to FULLSCREEN it, not MAXIMIZE it. –  Mar 05 '18 at 19:41
  • Fullscreen = no borders, no nothing, only the console. Maximized = borders, everything else, toolbar present. –  Mar 05 '18 at 19:54

1 Answers1

2

Create a console application and use this code: Source and a couple of fixes from me (tested on Windows 10):

using System;
using System.Runtime.InteropServices;

namespace Test
{
    internal class Program
    {
        [DllImport("kernel32.dll")]
        private static extern IntPtr GetStdHandle(int handle);

        private static void Main(string[] args)
        {
            IntPtr hConsole = GetStdHandle(-11);
            SetConsoleDisplayMode(hConsole, 1, out COORD b1);
            Console.ReadLine();
        }

        [DllImport("kernel32.dll", SetLastError = true)]
        private static extern bool SetConsoleDisplayMode(IntPtr ConsoleOutput, uint Flags, out COORD NewScreenBufferDimensions);

        [StructLayout(LayoutKind.Sequential)]
        public struct COORD
        {
            public short X;
            public short Y;

            public COORD(short X, short Y)
            {
                this.X = X;
                this.Y = Y;
            }
        }
    }
}
Emond
  • 50,210
  • 11
  • 84
  • 115