473,811 Members | 2,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to run app from service

Hello,

I'd like to run an application from a windows service.

I followed the instructions on the MS site to create a service but when it
starts Notepad - notepad window is not visible but process is there.
What could be the problem
My service has this code:

Process myProcess = new Process();
myProcess.Start Info.CreateNoWi ndow = false;
myProcess.Start Info.FileName = "notepad.ex e";
myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Maximized;
myProcess.Start ();
Thanks
Evgueni
Mar 13 '06 #1
4 1002
JV
I haven't done this in awhile but I seem to recall that you have to grant
the service permission to interact with the desktop. Keep in mind that
spawned processes will still be child processes to the service.

Try looking in the properties of your Windows Service in the service
manager. I think there's a checkbox to grant this.
"Wayfarer" <Wa******@discu ssions.microsof t.com> wrote in message
news:9F******** *************** ***********@mic rosoft.com...
Hello,

I'd like to run an application from a windows service.

I followed the instructions on the MS site to create a service but when it
starts Notepad - notepad window is not visible but process is there.
What could be the problem
My service has this code:

Process myProcess = new Process();
myProcess.Start Info.CreateNoWi ndow = false;
myProcess.Start Info.FileName = "notepad.ex e";
myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Maximized;
myProcess.Start ();
Thanks
Evgueni

Mar 13 '06 #2
Hello JV,

Take into account that this checkbox is not available in the next version
of the windows Vista
Calling UI from the services in bad behavior - use Startup user's folder
for this

J> I haven't done this in awhile but I seem to recall that you have to
J> grant the service permission to interact with the desktop. Keep in
J> mind that spawned processes will still be child processes to the
J> service.
J>
J> Try looking in the properties of your Windows Service in the service
J> manager. I think there's a checkbox to grant this.
J>
J> "Wayfarer" <Wa******@discu ssions.microsof t.com> wrote in message
J> news:9F******** *************** ***********@mic rosoft.com...
J>
Hello,

I'd like to run an application from a windows service.

I followed the instructions on the MS site to create a service but
when it
starts Notepad - notepad window is not visible but process is there.
What could be the problem
My service has this code:
Process myProcess = new Process(); myProcess.Start Info.CreateNoWi ndow
= false; myProcess.Start Info.FileName = "notepad.ex e";
myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Maximized;
myProcess.Start ();

Thanks
Evgueni

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 14 '06 #3
Hello Wayfarer,

What the reason for this? You need to understand that service is working
in absolutely different context then user IS. Moreover service starts *before*
user login. It's not so easy to perform what are u trying to do and this
is a bad behavior (iterating services with desctop options is removed in
the forthcoming version of windows).
I recomend u to put user depended code for start in the Starup folder
W> Hello,
W>
W> I'd like to run an application from a windows service.
W>
W> I followed the instructions on the MS site to create a service but
W> when it
W> starts Notepad - notepad window is not visible but process is there.
W> What could be the problem
W> My service has this code:
W> Process myProcess = new Process();
W> myProcess.Start Info.CreateNoWi ndow = false;
W> myProcess.Start Info.FileName = "notepad.ex e";
W> myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Maximized;
W> myProcess.Start ();
W> Thanks
W> Evgueni
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 14 '06 #4
Hello Michael,

The reason for that is to have a service wrapper that word run all the time
and
download-run another application on changed network conditions i.e. new ip
address.
An additional question is there an event about ip address change?
May be it doable via WMI?

Thanks
Evgueni

"Michael Nemtsev" wrote:
Hello Wayfarer,

What the reason for this? You need to understand that service is working
in absolutely different context then user IS. Moreover service starts *before*
user login. It's not so easy to perform what are u trying to do and this
is a bad behavior (iterating services with desctop options is removed in
the forthcoming version of windows).
I recomend u to put user depended code for start in the Starup folder
W> Hello,
W>
W> I'd like to run an application from a windows service.
W>
W> I followed the instructions on the MS site to create a service but
W> when it
W> starts Notepad - notepad window is not visible but process is there.
W> What could be the problem
W> My service has this code:
W> Process myProcess = new Process();
W> myProcess.Start Info.CreateNoWi ndow = false;
W> myProcess.Start Info.FileName = "notepad.ex e";
W> myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Maximized;
W> myProcess.Start ();
W> Thanks
W> Evgueni
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Mar 14 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
7033
by: Hardy Wang | last post by:
Hi all: I read an article from http://www.c-sharpcorner.com/Code/2003/Sept/InstallingWinServiceProgrammatically.asp about how to install a windows service programmatically. Based ont the code sample, it provides the feature to install service under LocalSystem account. What I need is to install service under some other certian account. By further studying the code, and MSDN...
7
712
by: Mike | last post by:
I want to create a windows service that will monitor another window service. what i need for the service to do is, if a service is stopped I need it to start the service back up example: service 1 - my service watches service 2 - windows service service 2 is stopped - service 1 starts service 2
9
7274
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service stopping. Please advise how to stop the service. Thanks, SP
3
57011
by: Jeremy S. | last post by:
On my dev machine (XP/Pro with VS.NET 2003) I have been developing a Windows Service and installing it on the local machine by opening the Visual Studio Command Prompt and then executing . Now I want to test this service on a Windows Server 2003 box that doesn't have the Visual Studio Command prompt. How do I go about installing the service on the Windows Server 2003 box? Thanks!
2
4692
by: letibal | last post by:
Hello, I have written a windows service and created an installer for it. The service runs under the system accounts. When started, it launches a GUI. By default, the InteractiveProcess property of the service is not set (this can be checked by right-clicking on the service in the Services window (Admin tools>Services), choosing Properties, LogOn tab). In order to enable my service to launch a GUI at startup, I added the following lines...
4
3184
by: kkt49 | last post by:
# vim: et sw=4 ts=8 sts from wxPython.wx import * import sys, os, time import pywintypes import win32serviceutil import win32service import win32event import win32process
4
21768
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a webserver to see if service A needs to be updated. What service B does if it sees their is an update for service A is to download a new copy of the service A executable, stop service A, replace the executable with the new copy, and start service B...
3
6630
dmjpro
by: dmjpro | last post by:
plz send me a good link which can clearify me how the J2EE framework works i want the details information .... plz help thanx
20
6756
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
I was executing the steps given in http://suppor.microsoft.com/kb/308359 for testing a sample web service application. However, the following line gives a compilation error: localhost.Service1 xxx = new localhost.Service1(); localhost is not recognized by the compiler.
5
3313
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
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
10386
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...
1
10398
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10133
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
9204
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...
0
6889
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.