Re: Make a Windows Service start a windows program.
- From: "Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx>
- Date: Wed, 22 Feb 2006 20:22:24 +0100
"deko" <deko@xxxxxxxxxx> wrote in message
news:fb6dnSB8jemRLWHeRVn-jg@xxxxxxxxxxxxxx
|> Well I mean that it's possible for the program that gets launched from a
| > Windows Service session, to load the environment and profile of an
| > interactive user, it's also possible to migrate the current desktop to
the
| > (visble) interactive desktop, but this is not a trivial task and
requires
| > some thorough understanding of the OS security system.
|
| I see.
|
| > | I have a similar situation where a service needs to instantiate an
| > object
| > | contained in a WinForms app. The service and the app are installed as
a
| > | pair; the UI is used to define the action taken by the service at
| > | pre-defined intervals.
| > |
| >
| > I suppose you mean instantiate an object through remoting right? This is
| > not
| > a problem as long as the WinForms app is started from an interactive
logon
| > session and not from the service.
|
| Well, that's the key question - can I do this without remoting?
|
| The service in question will run as a Local Service since it requires full
| system privaleges, but it gets launced (only) when a particular user logs
| in.
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).
The UI is run in the user's security context so only that user can
| adjust the parameters of the app's "projects" which are launched by the
| service. The "projects" are designed to run silently in the background in
a
| separate thread and require no interaction with the UI (that's why I am
| using a service).
|
| However, the service needs to instantiate the Project object in the
WinForms
| application - this contains all the business logic. So the service needs
to
| pass parameters to the Project class's constructor. That's why I thought
| the service and the app should be in the same assembly.
|
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? You said, the service creates an instance of class
'Project', how are you going to share the state between these two
applications?
| So do I really need Remoting here? I just want to instantiate the app's
| Project object from the service to allow the app's "project" to run in the
| service's thread and security context, while the app's UI is run in the
| users's thread and security context.
|
| Does this sound correct?
|
Willy.
.
- 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
- Make a Windows Service start a windows program.
- Prev by Date: Re: foreach Iterator - which is more efficient?
- Next by Date: Re: Trouble opening a file using BufferedStream
- 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
|