daveL said:
hi when i run the below code in a windows app
or a console app notepad opens just fine
when i run it from a Service it does not open in its own window
What is the cause of this
How can get a Service to Spawn and not be hidden
By default, services run in a non-interactive window station and cannot
interact with a logged-on user (if there is any). This is usually what you
want. Services typically run unattended and as highly privileged processes,
and it doesn't make sense to spawn windows that a non-privileged user can
interact with.
You first have to make sure what you want. There could be any number of
users logged on, from zero to many (for a Terminal Services service). Which
of these users should see the window? What if there are no users? Do you
really mean to run a process under the service's credentials (usually
LocalSystem, a highly privileged account), potentially allowing users to
compromise the system?
Usually, the solution is not to use a service for this in the first place.
Instead, use a process that automatically starts with user logon. Use a
service only for tasks that need to be performed regardless of whether a
user is logged on. If you need to both do things that must be done if nobody
is logged on *and* some things if somebody is logged on, use both a service
and an autostart process and have them communicate (for example through
named pipes or .NET Remoting).