0

I wrote some basic program (from the empty project) which shows window with some buttons, but everytime when I run it visual studio shows me shell black windows, how can I disable this behaviour? thanks in advance

geek
  • 2,677
  • 4
  • 23
  • 21

1 Answers1

0

do this:

[DllImport("kernel32.dll")]
static extern IntPtr GetConsoleWindow();

[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

const int SW_HIDE = 0;
const int SW_SHOW = 5;

var handle = GetConsoleWindow();

// Hide
ShowWindow(handle, SW_HIDE);

// Show
ShowWindow(handle, SW_SHOW);

source: Show/Hide the console window of a C# console application

Community
  • 1
  • 1
Davide Piras
  • 43,984
  • 10
  • 98
  • 147