Skip to content

Instantly share code, notes, and snippets.

@begedin
Created May 7, 2013 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save begedin/5532954 to your computer and use it in GitHub Desktop.
Save begedin/5532954 to your computer and use it in GitHub Desktop.
Function to set console window visibility.
public static void setConsoleWindowVisibility(bool visible, string title)
{
IntPtr hWnd = FindWindow(null, title);
if (hWnd != IntPtr.Zero)
{
if (!visible)
//Hide the window
ShowWindow(hWnd, 0); // 0 = SW_HIDE
else
//Show window again
ShowWindow(hWnd, 1); //1 = SW_SHOWNORMA
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment