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
Asked
Active
Viewed 340 times
0
-
just create a windows application project or console application project with the New Project Wizard instead of an empty one. – Davide Piras Sep 15 '11 at 14:56
-
check here as well: http://stackoverflow.com/questions/3571627/show-hide-the-console-window-of-a-c-console-application – Davide Piras Sep 15 '11 at 14:57
-
@Davide Piras: You can post it! – geek Sep 15 '11 at 15:04
1 Answers
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