U
Uriel Mondrowicz
Hi all,
I'm trying to build in C# a simple tool that should be used in dual mode:
1. Windows Application when called without any arguments (or simply
double-clicked)
2. Console Application when called from a command line with some arguments
I could create a parent console application that runs from a command line
(and sends its output to the stdout console) when it is called with some
arguments.
If it detects that no arguments were entered (args.Length == 0) it opens a
windows form using the frmGUI.ShowDialog() method.
My main problem is that when clicking on the tool executable to run it as a
win GUI, it will open a black console window for a second, dissapear, and
then show the GUI form.
This is very annoying, and I'm sure there is a way to resolve this black
screen issue.
I tried using FreeConsole() method in my entry point just before checking
the args but it still shows the black console for a second.
I have seen a C++ solution for that kind of implementation here:
http://www.codeguru.com/Cpp/W-D/console/redirection/article.php/c3955 but it
requires using an edditional .com file which is not good for me as it should
be a single file application.
Do you have an idea how can I make it work?
Thanks in advance,
Uriel Mondrowicz.
I'm trying to build in C# a simple tool that should be used in dual mode:
1. Windows Application when called without any arguments (or simply
double-clicked)
2. Console Application when called from a command line with some arguments
I could create a parent console application that runs from a command line
(and sends its output to the stdout console) when it is called with some
arguments.
If it detects that no arguments were entered (args.Length == 0) it opens a
windows form using the frmGUI.ShowDialog() method.
My main problem is that when clicking on the tool executable to run it as a
win GUI, it will open a black console window for a second, dissapear, and
then show the GUI form.
This is very annoying, and I'm sure there is a way to resolve this black
screen issue.
I tried using FreeConsole() method in my entry point just before checking
the args but it still shows the black console for a second.
I have seen a C++ solution for that kind of implementation here:
http://www.codeguru.com/Cpp/W-D/console/redirection/article.php/c3955 but it
requires using an edditional .com file which is not good for me as it should
be a single file application.
Do you have an idea how can I make it work?
Thanks in advance,
Uriel Mondrowicz.