Start a Windows app from a Window service

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

is it possible to start a windows application from within a windows service?

I was thinking of having a windows service on a set of clients poll a
central machine for messages. If one arrives for a certain client I would
start up a windows application to notify the user.

Is this possible?
 
cashdeskmac said:
is it possible to start a windows application from within a windows
service?

You can start the application with Process.Start(...). However, the
default configuration of the Windows Service will prevent the application
from interacting with the desktop, so this will not be very useful.
To give the Windows Service (and the application started from it) the
ability to interact with the Desktop, you can use the Services applet from
the Administrative Tools in Control Panel, edit the Properties of your
service, and select the checkbox "Allow Service to interact with desktop".
Be careful with the things that your program does, since it will be
running with elevated privileges (the service account) rather than the
account of the logged-in user.
 
cashdeskmac said:
Hi,

is it possible to start a windows application from within a windows service?

I was thinking of having a windows service on a set of clients poll a
central machine for messages. If one arrives for a certain client I would
start up a windows application to notify the user.

Is this possible?

Are you going to alert the "user" using other methods as well? If not,
what happens if the user isn't logged on such as on a server? I'd prefer
logging to the System event log and logging to possibly an application
log file and if I want to read the log I'll open the application myself
or look at Event viewer.

Brandon
 
Thanks, Alberto.

is it possible to assign a value to "Allow Service to interact with desktop"
during deployment, as part of the build process or directly in code?
 
cashdeskmac said:
is it possible to assign a value to "Allow Service to interact with
desktop"
during deployment, as part of the build process or directly in code?

I have seen this question asked a few times in various forums, but never
saw an answer. As far as I know, you can't do it in the same way as you
configure the rest of the properties of the Service by means of the
ServiceInstaller and ServiceProcessInstaller. The only alternative that I
can think of is to modify directly the Windows Registry. Change an existing
service to "Allow Service to interact with desktop", explore the registry to
see what setting changed in that service, and then use some code to apply
during deployment the same chage to the registration of your service in the
Registry.
 
cashdeskmac said:
Thanks, Alberto.

is it possible to assign a value to "Allow Service to interact with
desktop"
during deployment, as part of the build process or directly in code?


Not without a registry hack, however you shouldn't NOT set the option, this
option was invented to allow for service debugging purposes when NT was
first released, but more importantly it's no longer supported on Vista.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top