Re: Make a Windows Service start a windows program.
- From: "Ciaran" <ciaran@xxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Feb 2006 21:43:15 -0000
Sounds to me like a normal application running with a notify icon rather
than a form would be the best way to achieve what your after. Then it would
just be an icon in the system tray. Or it could just be a window app without
a form.
HTH
Ciaran
"deko" <deko@xxxxxxxxxx> wrote in message
news:FPKdnc4stqRxV2HeRVn-gg@xxxxxxxxxxxxxx
Services aren't lauched when users logs in, services are lauched at
system
start-up, Applications that depend on interactive logon session, should
never be implemented as Windows Services, they should be normal
applications
that get started at logon (search for Autorun in windows help).
Only the UI portion of the app depends on an interactive logon. The
service can start at system boot. I was thinking I could start it at user
log on, but, as you say, that dependency is not what services are all
about. good point.
The applications should run in separate processes, so you need a 'way' to
create remote instances of classes residing in a Winforms application.
One
way is through remoting (assumed both are managed apps.) and another one
is
through COM interop.
One question remain, what's the use of the object instance from the UI
applications perspective?
When the service instantiates the Project object from the class in the UI
app (at predefined "run time" intervals), lots of IO stuff happens. From
the UI app's perspective, this "run time" instance does not need to expose
anything. The UI will retreive information about the results of the
completed "project" from an XML file that the service logs to.
You said, the service creates an instance of class
'Project', how are you going to share the state between these two
applications?
That's a good question - is this possible only through remoting? As I
mentioned above, the service will write to an XML file, so I can retrieve
the project results from that, unless I can get these results from the
state of the object instantiated by the service. But is that not possible
when that instance was created by a separate thread? (the service and the
UI are both managed)
Thanks for your comments - I'm still rather green with .NET and appreciate
you insights. There may well be another way to do this, but a service is
my preference because the IO stuff that need to be done is based on system
up time, not user log-in time. And using a service gives me the separate
thread so the user can work with the UI app while a project is running.
Also, a Local Service has will have the required security context to
perform the IO tasks at hand.
PS. The search matches I found for "Autorun" were for CDs and Pocket PC.
Were referring to having a shortcut to the app in the windows startup
folder?
.
- Follow-Ups:
- References:
- Make a Windows Service start a windows program.
- From: UJ
- Re: Make a Windows Service start a windows program.
- From: Willy Denoyette [MVP]
- Re: Make a Windows Service start a windows program.
- From: KBuser
- Re: Make a Windows Service start a windows program.
- From: Willy Denoyette [MVP]
- Re: Make a Windows Service start a windows program.
- From: deko
- Re: Make a Windows Service start a windows program.
- From: Willy Denoyette [MVP]
- Re: Make a Windows Service start a windows program.
- From: deko
- Re: Make a Windows Service start a windows program.
- From: Willy Denoyette [MVP]
- Re: Make a Windows Service start a windows program.
- From: deko
- Make a Windows Service start a windows program.
- Prev by Date: Re: Typecasting DateTime
- Next by Date: Re: PInvoke - Structures
- Previous by thread: Re: Make a Windows Service start a windows program.
- Next by thread: Re: Make a Windows Service start a windows program.
- Index(es):
Relevant Pages
|