473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Writing an app for both WinForms and Console use

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
2 1770
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: ion | last post by:
Hi! Is there a way to write messages to the javascript console? Like a debug.write() method? Thanks! Ion
3
by: andrewcw | last post by:
I have a class with a number of functions. For some form of errors I wanted to use the MessageBox function of Window.Forms. I want to reuse this code in a console application, but now I see I...
7
by: Ori | last post by:
Hi, I would like to create some mechanism to handle all the exceptions which will happen in my application. I have one form which is the base form while all the other forms inherit from it. ...
4
by: Shil | last post by:
Hi, In VC++.Net 2005 visual studio, if I create a new winform drag and drop a button, then double click it to write click event code, then it auto generates the template code for the event in...
2
by: Michael D. Ober | last post by:
Is there a way to create a System.Console from code. I periodically have a WinForms app that needs to open a console window for progress tracking. Thanks, Mike Ober.
4
by: eduardorp1 | last post by:
I have a GUI application that needs to be invoked from the command line as well. It should work both as a GUI and as a console application. When I invoke it from the command line, it reads all...
8
by: Julian | last post by:
hi, i have the following piece of code in a program compiled using both VC8 and VC6. it basically just writes out two arrays to cout. the VC6 program takes about 4 seconds to go through that bit of...
6
by: Joe | last post by:
We pass args to our WinForms app and would like the console to wait until the program ends before returning. For example: C:MyApp.exe -r something This returns even though the process is...
1
by: ffimbel | last post by:
Hi I would like to implement a single exe which could be invoked either as a standard windows form (no argument) or as a console app (when run with app.exe -nologo). I tried compiling the exe...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.