[DllImport(
"user32.dll"
, EntryPoint =
"ShowWindow"
, SetLastError =
true
)]
private
static
extern
bool
ShowWindow(IntPtr hWnd,
uint
nCmdShow);
[DllImport(
"user32.dll"
, EntryPoint =
"FindWindow"
, SetLastError =
true
)]
private
static
extern
IntPtr FindWindow(
string
lpClassName,
string
lpWindowName);
Console.Title = Guid.NewGuid().ToString(
"n"
);
var w = FindWindow(
"ConsoleWindowClass"
, Console.Title);
if
(w != IntPtr.Zero)
ShowWindow(w, 0);