By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,657 Members | 1,197 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,657 IT Pros & Developers. It's quick & easy.

Window and console application all in one

P: n/a
Hello everyone,
I'm have a window application, but it is a console application
too. I'll try to explain better: if I call the program without
parameters the GUI starts. Otherwise it runs as a console application.
In other words, I emulate the "certmgr" behavior.
My problem is I cannot display any trace in the console (Someghing
like: Pass 1: OK, Pass 2: etc). Console.Write does not work, because
the window application has not a console. Is there any method to show
redirect the input to the console? Please could you give me any
example?

Thanks all, Gionni
Jul 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi, Gionni

compile application as Console project. It will do the trick.
In Main check if arguments are present and act accordingly.

HTH
Alex

"Gionni" <eh*******@katamail.com> wrote in message
news:d9**************************@posting.google.c om...
Hello everyone,
I'm have a window application, but it is a console application
too. I'll try to explain better: if I call the program without
parameters the GUI starts. Otherwise it runs as a console application.
In other words, I emulate the "certmgr" behavior.
My problem is I cannot display any trace in the console (Someghing
like: Pass 1: OK, Pass 2: etc). Console.Write does not work, because
the window application has not a console. Is there any method to show
redirect the input to the console? Please could you give me any
example?

Thanks all, Gionni

Jul 21 '05 #2

P: n/a
"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message news:<OO**************@tk2msftngp13.phx.gbl>...
compile application as Console project. It will do the trick.
In Main check if arguments are present and act accordingly.
Thanks, I tested it and works.
Only one thing more. Is there any way to make the command prompt
disappear when I do a double click on my application?
HTH
Alex


Thanks again, Gionni
Jul 21 '05 #3

P: n/a
Hi, Gionni

You can do this if you get console window handle and hide it using win32
API. Look for GetConsoleWindow and ShowWindow functions in platform SDK or
on MSDN. You need to get handle of console and do ShowWindow on it with
SW_HIDE parameter. Declarations for functions you can find on
www.pinvoke.net and on several other sites.

HTH
Alex

"Gionni" <eh*******@katamail.com> wrote in message
news:d9*************************@posting.google.co m...
"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message

news:<OO**************@tk2msftngp13.phx.gbl>...
compile application as Console project. It will do the trick.
In Main check if arguments are present and act accordingly.


Thanks, I tested it and works.
Only one thing more. Is there any way to make the command prompt
disappear when I do a double click on my application?
HTH
Alex


Thanks again, Gionni

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.