Service application + ShellExecute/CreateProcess

Giganews Newsgroups
Subject: Service application + ShellExecute/CreateProcess
Posted by:  Rabusier (noema…
Date: 13 Sep 2006


I wrote a service application which needs in some specific
cases to run an application. A TCP server is embedded into
the service application and commands are read from the
connection. When a given command is received, GUI app
have to be launched.

The application I need to run has an user interface and
the user has to interact with it. So, I wonder how the service
can detect that an interactive session has been opened to
avoid to run the application when nobody is connected to
the computer... Is there a specific API I can use in order
to detect if someone is connected to the computer ?

More generally, what happens :

- If a service app call ShellExecute()/CreateProcess() in
order to run an interactive process while there is no
interactive session opened on the computer ?
- ... if there is more than one session opened on the
computer (My intention would be to "catch" the active one
but I guess that there may be more than one active session
in some editions of Windows (TSE ?))

Best regards.