Skip to content

Instantly share code, notes, and snippets.

@omni-
Last active August 29, 2015 14:02
Show Gist options
  • Save omni-/abe51695d34149881eb2 to your computer and use it in GitHub Desktop.
Save omni-/abe51695d34149881eb2 to your computer and use it in GitHub Desktop.
Fullscreen console
using System;
using System.Runtime.InteropServices;
namespace fullscreen
{
[DllImport("kernel32.dll", ExactSpelling = true)]
public static extern IntPtr GetConsoleWindow();
public static IntPtr ThisConsole = GetConsoleWindow();
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); public const int HIDE = 0; public const int MAXIMIZE = 3;
public const int MINIMIZE = 6; public const int RESTORE = 9;
public static void Main(string[] args)
{
Console.SetWindowSize(Console.LargestWindowWidth - 4, Console.LargestWindowHeight);
ShowWindow(ThisConsole, MAXIMIZE);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment