Hide Black Console Window later in program
-
Dear Sirs, I searched online and the forums and can't find the answer to my question. I would like my program to hide its console window in a managed way, but only AFTER allowing the program to output there. Basically, it goes like this:
public .ctor()
{
_Init();
_Open_SS();
System.Console.Hide();/*believe it or not, this doesn't work!*/
}So, if anyone knows how to do this in a MANAGED-ONLY context (I don't want to use
DllImport("Kernel32.dll")]extern int FreeConsole();
). Thanks in advance for your help!! In Christ, Aaron Laws http://ProCure.com -
Dear Sirs, I searched online and the forums and can't find the answer to my question. I would like my program to hide its console window in a managed way, but only AFTER allowing the program to output there. Basically, it goes like this:
public .ctor()
{
_Init();
_Open_SS();
System.Console.Hide();/*believe it or not, this doesn't work!*/
}So, if anyone knows how to do this in a MANAGED-ONLY context (I don't want to use
DllImport("Kernel32.dll")]extern int FreeConsole();
). Thanks in advance for your help!! In Christ, Aaron Laws http://ProCure.comI know you said Managed code, however I don't see any way of avoiding it as the console is an unmanaged host for the application output. However I would recommend
[DllImport("user32.dll")]static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
rather than
FreeConsole
as you don't really want to detach the process from the console, just hide the console. Well, having said that, maybe you do, but I wouldn't.If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk
-
I know you said Managed code, however I don't see any way of avoiding it as the console is an unmanaged host for the application output. However I would recommend
[DllImport("user32.dll")]static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
rather than
FreeConsole
as you don't really want to detach the process from the console, just hide the console. Well, having said that, maybe you do, but I wouldn't.If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk
I use FreeConsole for applications than can be run in either console or GUI mode.