By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,659 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,659 IT Pros & Developers. It's quick & easy.

Execute an external application from windows service.

P: n/a
Hi group I have been making a windows service to execute an external
application. I use a timer control, I can execute the application but
does't appear as a normal windows, just I see it in the windows task manager
as a
local service. I think it must appear as a normal process. Someone
knows about it or has any idea?

Juan Manuel Alegria B.
Jalisco, México.
Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I've never done this myself (I've done windows services just not had the
need to display a window on the desktop) so you can take this however
you'd like. However I think you may have to configure the service to
allow interaction with the desktop. To do this you need to open the
service manager, double click on your service, select the Log On tab,
and check the box that allows the service to interact with the desktop.
At least that is how you enable it on Win 2k3, but you should have
similar options in whatever version of the OS you are using. You can
probably also enable this through your setup application but like I said
I've never needed to. Hope this does it for you.

Have A Better One!

John M Deal, MCP
Necessity Software

Juan Manuel Alegría B. wrote:
Hi group I have been making a windows service to execute an external
application. I use a timer control, I can execute the application but
does't appear as a normal windows, just I see it in the windows task manager
as a
local service. I think it must appear as a normal process. Someone
knows about it or has any idea?

Juan Manuel Alegria B.
Jalisco, México.

Jul 21 '05 #2

P: n/a
John M Deal <jo******@necessitysoftware.com> wrote in message news:<uE*************@TK2MSFTNGP14.phx.gbl>...
Juan Manuel Alegría B. wrote:
Hi group I have been making a windows service to execute an external
application. I use a timer control, I can execute the application but
does't appear as a normal windows, just I see it in the windows task manager
as a
local service. I think it must appear as a normal process. Someone
knows about it or has any idea?

Juan Manuel Alegria B.
Jalisco, México.

I've never done this myself (I've done windows services just not had the
need to display a window on the desktop) so you can take this however
you'd like. However I think you may have to configure the service to
allow interaction with the desktop.


No!! This is a very bad idea for security reasons : the windowing
system is absolutely unsecure and should not be used in privileged
contexts such as services. Google on "shatter attack" if you are
interested in the details.
Also, it could be that interactive services would be removed in the
next Windows release for this very security concern.

To the OP : You have several options:
- if you need a window in your external app *just* for a timer, do not
use windows at all and use another timer mechanism that doesn't need a
window (System.Threading.timer for example).

- if your external window really needs and use windows (because it is
a GUI app), you should get informed on the impersonnation / DACLs /
Window Station / Desktop mechanisms of Windows. As those concepts
aren't mapped in .NET (as far as I know), you should do a bit of
unmanaged calls (Win32 Security API calls) : look at the
SetProcessWindowStation / SetThreadDesktop functions. (complete C
example at http://msdn.microsoft.com/library/de...ss_in_c__.asp).
Please note that you should use CreateProcessAsUser on an unprivileged
user account to avoid having an interactive process running under
SYSTEM account (always for the same shatter attack reason).

- as the 2nd option is a bit messy (especially when used in a .NET
environnement), you should perhaps reconsider your design : does your
service *really* needs to start an interactive process? Couldn't this
process be in the "Start" folder in the start menu of your user
instead? It's impossible to offer a better advice without more
knowledge about your app.

Arnaud
MVP - VC
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.