473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Execute an external application from windows service.

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
2 3548
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tom | last post by:
Hi, I wrote a java console program. But, I am not familiar with Swing to write the GUI. I want to use C# to write the GUI, e.g. a start and a stop buttons. When I click the start button, it...
4
by: Chris | last post by:
I posted this in the C# language group, then thought it might be more appropriate in this group. I would not cross-post except I want the answer so badly. I built small C# Web and Web Service...
1
by: Xavitin | last post by:
Hello, I have a piece of code that runs Ok in a normal Windows application, but not when run as a windows service. The code tries to run an external program (ARJ32.EXE). The code is : ...
2
by: Juan Manuel Alegría B. | last post by:
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...
0
by: lcifers | last post by:
I have written an application and tested it as a Windows executable. It works fine. The application uses an external COM application to process some existing files. But I can't seem to start that...
3
by: Jay | last post by:
hi i am jay from bangalore i have one problem ,can u please help me out. i have one windows application and one windows service. from windows application i have to call one process "gpg" to...
1
by: gaurav tyagi | last post by:
hi mahesh i am gaurav from bangalore i have one problem ,can u please help me out. i have one windows application and one windows service. from windows application i have to call one process...
4
by: =?Utf-8?B?TEJU?= | last post by:
Good day, I would like to execute an external application from a web form created using ASP.Net. I'm using System.Diagnostics.Process. It works fine if it is notepad.exe but it is not able to...
1
by: mikelujan | last post by:
Hi, Our application starts an external application using System.Diagnostics.Process class and the Start() method, as per code snippet below. This application run as a Windows service, and must...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.