2011-09-15 4 views
0

빈 프로젝트에서 몇 개의 버튼이있는 창을 표시하는 기본 프로그램을 작성했지만 시각적으로 스튜디오를 실행할 때마다 쉘 검정 창을 표시 할 때 어떻게 이러한 동작을 비활성화 할 수 있습니까?C# 프로그램을 실행하는 동안 쉘 창을 사용하지 않음

+0

그냥 새 프로젝트 마법사 대신 빈 하나에 Windows 응용 프로그램 프로젝트 또는 콘솔 응용 프로그램 프로젝트를 만듭니다. –

+0

여기를 확인하십시오 : http://stackoverflow.com/questions/3571627/show-hide-the-console-window-of-a-c-console-application –

+0

@Davide Piras : 게시 할 수 있습니다! – geek

답변

0

이렇게 사전에 감사 :

[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); 

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

관련 문제