473,785 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3582
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******@neces sitysoftware.co m> wrote in message news:<uE******* ******@TK2MSFTN GP14.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.Threadi ng.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
SetProcessWindo wStation / SetThreadDeskto p functions. (complete C
example at http://msdn.microsoft.com/library/de...ss_in_c__.asp).
Please note that you should use CreateProcessAs User 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
5464
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 execute the jar file. Or, I wrote a batch file and let the GUI to run it.
4
7882
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 applications in a training class last week. The applications worked in the class, but when I tried to run them again over the weekend, they both bombed. Instead of getting my Web page, or the Web Service page, I get a page full of error text...
1
4333
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 : myProcess.StartInfo.FileName = strRutaARJEXE myProcess.StartInfo.Arguments = " e -u -y " & strRutaFitxerARJ & " " & strRutaDescomprimir myProcess.StartInfo.UseShellExecute = False
2
931
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 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.
0
1351
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 external program correctly. I've found this code: ' Set process parameters Dim myProcess As New System.Diagnostics.Process myProcess.StartInfo.FileName = "notepad.exe" ' Allow the process to raise events
3
3626
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 encrypt my text file so i use system.Diagnostics.process class to make new process. my code is like this
1
1403
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 "gpg" to encrypt my text file so i use system.Diagnostics.process class to make new process. my code is like this
4
8484
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 execute even a simple VB.Net windows application. No error is being returned. The application just can't be opened (even it is not found inside Task Manager of my web server). Any idea? I'm using IE v 6.0.2900.2180.xpsp_sp2_gdr.050301-1519. My code...
1
2232
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 start several instances of the same application, like multiple Windows Calculators for instance. We are experiencing difficulties starting applications after a certain number have been started. We changed our app to work as a Console...
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10350
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8983
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.