Question: I have a console program that shouldn\'t be seen. (It resets IIS and deletes temp files.)
Right now I can manage to hide the window right after start like
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("kernel32")]
public static extern IntPtr GetConsoleWindow();
[DllImport("Kernel32")]
private static extern bool SetConsoleCtrlHandler(EventHandler handler, bool add);
static void Main(string[] args)
{
IntPtr hConsole = GetConsoleWindow();
if (IntPtr.Zero != hConsole)
{
ShowWindow(hConsole, 0);
}
}
This should do what your asking.