I have a small application that launches an application via the shell
function when a listening socket receives data from another PC. This works
fine using a WinForms environment.
However, I want this listing app to run in the background as a service.
When debugging the service, the line -
ID = Shell("C:\TestA pp.exe", AppWinStyle.Nor malFocus)
returns a PID value, executes without errors, but the program "TestApp.ex e"
doesn't start. Task manager show TestApp as a running process, but it
really didn't because it would have incremented a value in a database.
Once again the code runs fine in WinForms but not as a service.
Any suggestions would be greatly appreciated.
Dave M 9 1517
"dave m" <da***@nexcorte ch.com> schrieb: I have a small application that launches an application via the shell function when a listening socket receives data from another PC. This works fine using a WinForms environment.
However, I want this listing app to run in the background as a service. When debugging the service, the line -
ID = Shell("C:\TestA pp.exe", AppWinStyle.Nor malFocus)
returns a PID value, executes without errors, but the program "TestApp.ex e" doesn't start. Task manager show TestApp as a running process, but it really didn't because it would have incremented a value in a database.
This doesn't work "by design". Services can even run if no user is logged
on and thus cannot have access to the desktop. I suggest to rethink whether
a service is the right choice. Maybe an application which gets started when
the user logs on is a viable alternative.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Not sure this is correct, Herfried . 1) The user doesn't mention "the
desktop" does he? 2) In any case, Services can for sure interact with the
current desktop (if it's loaded) if they so wished. Why do you say they
cannot?
Anyway... Dave M,
1) you mention a "database." Services are typically set to run under the
Local System account and are limited in their network access. Have you tried
running your service under a different user account (you can configure this
in Windows' Computer Management console). But that brings up another
question....
2) I'm not sure if processes spawned using "Shell" inherit the environment
of the caller program if the caller is a service. They probably do. I'm
almost sure of it. But you may need to look into Process.Start (and possibly
ProcessStartInf o if you need fine-grained control) to spawn your process and
get it to work right with the right privileges.
--
-C. Moya www.cmoya.com
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:eD******** ******@TK2MSFTN GP12.phx.gbl... "dave m" <da***@nexcorte ch.com> schrieb:I have a small application that launches an application via the shell function when a listening socket receives data from another PC. This works fine using a WinForms environment.
However, I want this listing app to run in the background as a service. When debugging the service, the line -
ID = Shell("C:\TestA pp.exe", AppWinStyle.Nor malFocus)
returns a PID value, executes without errors, but the program "TestApp.ex e" doesn't start. Task manager show TestApp as a running process, but it really didn't because it would have incremented a value in a database.
This doesn't work "by design". Services can even run if no user is logged on and thus cannot have access to the desktop. I suggest to rethink whether a service is the right choice. Maybe an application which gets started when the user logs on is a viable alternative.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
"CMM" <cm*@nospam.com > schrieb: Not sure this is correct, Herfried . 1) The user doesn't mention "the desktop" does he? 2) In any case, Services can for sure interact with the current desktop (if it's loaded) if they so wished. Why do you say they cannot?
Services can interact with the desktop, but this is neither recommended nor
a suitable solution when starting other applications, IMO. Be aware that
the OP wanted to start the application in a way that its windows are visible
on the currently logged on user. Even starting the application under a
different user account using impersonation won't fix the problem.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
And I recall reading somewhere that in Windows Vista, services will *no
longer* be able to interact with the desktop so if the OP plans to
migrate to Vista when it comes out in January, it would be best to
avoid it.
"Chris Dunaway" <du******@gmail .com> schrieb: And I recall reading somewhere that in Windows Vista, services will *no longer* be able to interact with the desktop
That's IIRC true.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
> the OP wanted to start the application in a way that its windows are visible on the currently logged on user.
I misunderstood the OP in that case. You are right that if his intention is
to (eventually) launch an interactive app, it only makes sense to add his
"service" to "HKLM\...\R un" in the registry rather than have it run as a
service.
--
-C. Moya www.cmoya.com
I highly doubt that. Service accounts may be "hardened" by default in Vista
but I can't see this functionality being completely taken away as it would
break stuff like the secondary logon services and RunAs... unless MS hides
the functionality for themselves which would violate almost every Anti-trust
ruling again it. I'm sure other 3rd party services might possibly break as
well (iPod watcher comes to mind as a possibility).
--
-C. Moya www.cmoya.com
"Chris Dunaway" <du******@gmail .com> wrote in message
news:11******** **************@ e56g2000cwe.goo glegroups.com.. . And I recall reading somewhere that in Windows Vista, services will *no longer* be able to interact with the desktop so if the OP plans to migrate to Vista when it comes out in January, it would be best to avoid it.
"CMM" <cm*@nospam.com > schrieb: I highly doubt that. Service accounts may be "hardened" by default in Vista but I can't see this functionality being completely taken away as it would break stuff like the secondary logon services and RunAs... unless MS hides the functionality for themselves which would violate almost every Anti-trust ruling again it. I'm sure other 3rd party services might possibly break as well (iPod watcher comes to mind as a possibility).
I don't think this change would pose such a big problem. Impersonation will
still be possible in Vista, and services which require user interaction
can/should be split up into the service and a separate application which
runs on the user's desktop once the user logs on and then communicates with
the service. This approach has already been recommended by Microsoft for
some time now:
<URL:http://groups.google.d e/group/microsoft.publi c.de.german.ent wickler.dotnet. csharp/msg/628a30f8d007de4 4>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Thanks for taking the time to reply.! I see the errors of my ways and you
saved me alot of time and frustration!
Dave M
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:eD******** ******@TK2MSFTN GP12.phx.gbl... "dave m" <da***@nexcorte ch.com> schrieb:I have a small application that launches an application via the shell function when a listening socket receives data from another PC. This works fine using a WinForms environment.
However, I want this listing app to run in the background as a service. When debugging the service, the line -
ID = Shell("C:\TestA pp.exe", AppWinStyle.Nor malFocus)
returns a PID value, executes without errors, but the program "TestApp.ex e" doesn't start. Task manager show TestApp as a running process, but it really didn't because it would have incremented a value in a database.
This doesn't work "by design". Services can even run if no user is logged on and thus cannot have access to the desktop. I suggest to rethink whether a service is the right choice. Maybe an application which gets started when the user logs on is a viable alternative.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Will Seay |
last post by:
At the end of this message I've pasted a script we're trying to modify
slightly. I don't believe it is VBscript or javascript but these are
the closest groups I could find with my limited programming knowledge.
Basically, we are trying to add a few lines to this script that will
execute a few shell commands (see comments at the very end of the
code). We think this may be ActionScript2 but aren't sure.
If you can offer any help, or know...
|
by: none |
last post by:
Hello all, I wrote a shell program a few years ago in VB6 that needs
to be modified. The problem I have is this:
The SysAdmin uses this shell in place of Explorer, so there is no
taskbar. When his users run PC Anywhere from the shell, and minimize
it, it minimizes to the system tray. With no task bar, there is no
system tray, so there is no way to restore the PC Anywhere window.
The shell starts PC Anywhere using ShellExecute. I...
|
by: Xah Lee |
last post by:
Python Doc Problem Example: os.system
Xah Lee, 2005-09
today i'm trying to use Python to call shell commands. e.g. in Perl
something like
output=qx(ls)
in Python i quickly located the the function due to its
|
by: JerryKreps |
last post by:
Hi, folks --
I'm a Python pup.
As you can see from the session copied at the end of this post, I have the latest version of Python, and I've been using the Editor-Shell of the latest version of Boa Constructor while going through some Python tutorials.
Everything was working as expected until I started using the raw_input built-in function.
There seems to be some unreliable behavior in Boa Constructor's Editor - Shell. If you look...
|
by: skinnybloke |
last post by:
Hi - I am a newbie to Access & SQL and I would appreciate some help on
this if at all possible.
I have a query that contains the following code.
SELECT DISTINCT Product. AS ,
Product. AS ;
The problem I have is that the Product. contains
characters that I do not want displayed in the query but are required
| |
by: Rob |
last post by:
Hi all,
I am having trouble converting the code below (found on
http://vbnet.mvps.org/index.html?code/core/sendmessage.htm) into a
format that will work using vb .NET.
Can anyone have a look at it and let me know what I need to change. I
have tried changing the "hwnd" type into intptr's but there seem to be
other problems too, like it won't allow "lParam As Any" to be
declared.
|
by: Rob R. Ainscough |
last post by:
I'm using the Diagnostics.Process approach to shelling out run the
following:
C:\Windows\System32\MSIEXEC.EXE /x {73F1BDB7-11E1-11D5-9DC6-00C04F2FC33B} /q
..FileName = "C:\Windows\System32\MSIEXEC.EXE"
..Arguments = "/x {73F1BDB7-11E1-11D5-9DC6-00C04F2FC33B} /q"
..Start()
I do a WaitForExit and get an error code back from MSIEXEC of 1605 -- this
|
by: Sh0t2bts |
last post by:
Hi,
I am using the below command to restart a service on one of my web
boxes, this runs fine from the command prompt and also through a *.bat
file.
"\\Server1\Applist$\BOBJCentralMS\psservice.exe" \\Server2 -u
eutee-ww02p\Username -p password restart BOBJCentralMS
|
by: Mark Shewfelt |
last post by:
Hello,
I am attempting to use Popen() in a Windows service. I have a small
Win32 .exe that I normally run through the os.popen2() function. I've
written a class to work with the input and output parameters that are
passed and captured from this exe. When I use the class outside of a
service using either subprocess.Popen or os.popen2 work just fine.
When I use this class inside a Windows service it doesn't work. It
doesn't crash the...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |