Article View: borland.public.cppbuilder.nativeapi
Article #17113Re: Open one application from a service
From: Remy Lebeau (TeamB)
Date: Wed, 09 Apr 2003 16:58
Date: Wed, 09 Apr 2003 16:58
25 lines
1940 bytes
1940 bytes
"Vic" <victor@espainformatica.com> wrote in message
news:3e9437a8@newsgroups.borland.com...
> the problem is that when the ShellExecute is executed, a
> process called "calc.exe" is added to process list, but the
> app is not visible. How can I solve it ?
Services run under their own desktop which is separate from the visual
desktop that the user sees. As such, when you spawn a process from a
service, the process runs under the service's desktop, not the user's. That
is why you can't see it.
You need to use CreateProcess() instead of ShellExecute(). The STARTUPINFO
structure that you pass to CreateProcess() contains an lpDesktop field that
you can fill in with the name of the correct desktop that the process should
run under, ie:
STARTUPINFO si = {0};
si.lpDesktop = "WinSta0\\Default";
...
CreateProcess(..., &si, ...);
Gambit
Technical Details
Message-ID:
<3e94510f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!out.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3e9437a8@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,2c7710b325cdf21a X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-04-09 09:59:28 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3e9437a8@newsgroups.borland.com> Subject: Re: Open one application from a service Date: Wed, 9 Apr 2003 09:58:12 -0700 Lines: 27 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3e94510f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1049907471 207.175.226.26 (9 Apr 2003 09:57:51 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!out.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail