Re: C# Console app with hidden window and user input
- From: Dilip <rdilipk@xxxxxxxxx>
- Date: Thu, 06 Sep 2007 21:00:19 -0000
On Sep 6, 3:42 pm, Doug Semler <dougsem...@xxxxxxxxx> wrote:
On Sep 6, 4:25 pm, Dilip <rdil...@xxxxxxxxx> wrote:
On Sep 6, 3:16 pm, Doug Semler <dougsem...@xxxxxxxxx> wrote:
On Sep 6, 4:01 pm, Dilip <rdil...@xxxxxxxxx> wrote:
On Sep 6, 2:19 pm, Jon Skeet [C# MVP] <sk...@xxxxxxxxx> wrote:
Dilip <rdil...@xxxxxxxxx> wrote:
Why have you made it a console app if you don't want a console? Just
create a Windows Service or a simple Windows Forms app that happens not
to display any forms.
I should've prefaced my question with all of this.
The application *was* a service but strangely it also launches a
complex Winforms based application (now please don't ask me why or how
-- thats just the way it is). Under Vista however Services cannot
interact with the desktop (as they run on Session 0 which is different
from the ones UI apps run) and hence cannot launch another application
that displays UI.
So I am trying to work backwards by converting that application to a
console app but w/the console window hidden.
But why not a Windows Forms app that doesn't show any forms? That
sounds like the way forward.
You are not going to believe this but the only reason why this app was
made a service was because the original team did not want it popping
up a console window. In all respects this app was born as a console
app and it does nothing that would bestow the boon of being a service
on it (for example it doesnt and cannot run while there is no user
logged on). So in reality, when the app is under development we
usually use it as a console app which just waits on a console.readline
statement. The reason its waiting on that statement is because after
the user hits enter (or whatever) the app executes clean up code AND
pulls down the UI app (that it launched on start up) at the same
time. On deployment it gets installed as a service and an external
batch script just starts and stops it using the SCM. OnStart launches
the UI app, OnStop executes clean up code and shuts down the UI app.
Now, you see where I am going? This app is *already* a console app.
I don't want to get into the hassle of converting it into a winforms
app. I wanted to retain it as a console app but find a way to shut it
down gracefully while the console window remains hidden.
Move your initialization and cleanup code into the windows application
that is launched. Get rid of the console app, and require the user to
double click the windows application instead.
See.. now you are treating me like a moron :-) I explained the
problem in a way that wouldn't pull in a lot of needless information
that would definitely be irrelevant to you. There is a reason why
that console app exists and its not to simply launch the UI app. it
does a whole bunch of other things that if I start writing down will
obscure the problem completely.
Actually, you have changed the problem domain entirely. However, based
on your current explanation you have the following:
Application A
Initializes something (irrelevant what it is)
Launches App B
Waits for a signal (currently Console.ReadLine)
Brings down application B
Cleans up something (again irrelevant)
Application B
"Complicated" Windows Application that does something.
I have serious issues with this design.
I need to bring this thread to a close but since you took so much time
to type up your opinion I would be insulting you by not responding. I
will keep this short. This is the way this application has been
written and most of your concerns have been handled one way or the
other. I don't know why its written this way and I am pretty sure in
hindsight I myself would embark on thousand different ways of doing
things. Its a little too late in the day to do any major
rearchitecting since the project has been around for 5 years now.
as things stand my task is to get it running on Vista and whether I
like it or not I *have* to stick to that :-)
.
- References:
- C# Console app with hidden window and user input
- From: Dilip
- Re: C# Console app with hidden window and user input
- From: Jon Skeet [C# MVP]
- Re: C# Console app with hidden window and user input
- From: Dilip
- Re: C# Console app with hidden window and user input
- From: Jon Skeet [C# MVP]
- Re: C# Console app with hidden window and user input
- From: Dilip
- Re: C# Console app with hidden window and user input
- From: Doug Semler
- Re: C# Console app with hidden window and user input
- From: Dilip
- Re: C# Console app with hidden window and user input
- From: Doug Semler
- C# Console app with hidden window and user input
- Prev by Date: Re: Couls someone translate VB->C# ?
- Next by Date: Re: High res timer
- Previous by thread: Re: C# Console app with hidden window and user input
- Next by thread: Re: C# Console app with hidden window and user input
- Index(es):
Relevant Pages
|