473,395 Members | 1,466 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,395 software developers and data experts.

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.StartInfo.CreateNoWindow = false;
myProcess.StartInfo.FileName = "notepad.exe";
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
myProcess.Start();
Thanks
Evgueni
Mar 13 '06 #1
4 988
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******@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.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.StartInfo.CreateNoWindow = false;
myProcess.StartInfo.FileName = "notepad.exe";
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.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******@discussions.microsoft.com> wrote in message
J> news:9F**********************************@microsof t.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.StartInfo.CreateNoWindow
= false; myProcess.StartInfo.FileName = "notepad.exe";
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.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.StartInfo.CreateNoWindow = false;
W> myProcess.StartInfo.FileName = "notepad.exe";
W> myProcess.StartInfo.WindowStyle = ProcessWindowStyle.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.StartInfo.CreateNoWindow = false;
W> myProcess.StartInfo.FileName = "notepad.exe";
W> myProcess.StartInfo.WindowStyle = ProcessWindowStyle.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
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...
7
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: ...
9
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...
3
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...
2
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...
4
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
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...
3
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
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...
5
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?...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.