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

Writing an app for both WinForms and Console use

P: n/a
I'm writing an application that I'd like to be able to use both as a Windows
Forms application, and also as a Console application.

If the app is started with no parameters, it should display its window and
allow the user to interact with it. If parameters are provided, it should
instead run as a console application and should output various information
to the standard output channel (so that the output can be redirected if
required).

By setting my app as a Windows Application, all Console methods are ignored.
By setting my app as a Console Application, all attempts to display Windows
Forms are ignored.

Is there any way to get a single application to act in both of these
different ways?

Thanks,

--

(O)enone
Apr 4 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can show windows form even dough your proejct is console type. You
just have to refrence the Windows.Forms.dll.

I would suggsest you that you put your logic and everything that does
not need a interface in a DLL and then make 3 seperate applications.
One for starting either a console or windows version. And then one
consoel and one windows version.

Apr 4 '06 #2

P: n/a
ja********@gmail.com wrote:
You can show windows form even dough your proejct is console type. You
just have to refrence the Windows.Forms.dll.
You're right -- and I described the behaviour incorrectly in my original
post. This way it works fine except that when running from within Windows,
an empty console window appears in the background, which looks awful.
I would suggsest you that you put your logic and everything that does
not need a interface in a DLL and then make 3 seperate applications.
One for starting either a console or windows version. And then one
consoel and one windows version.


Thanks for the suggestion!

--

(O)enone

Apr 4 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.