Article View: borland.public.cppbuilder.nativeapi
Article #4908Re: Spawning and controlling
From: Denville Longhurst
Date: Fri, 11 Nov 2005 18:29
Date: Fri, 11 Nov 2005 18:29
34 lines
1902 bytes
1902 bytes
Thanks, I didn't know about access(). The stumbling block here was to find the HWND from the process information so I could send a close message. I gather I must enumerate all running processes to find the process id then get the handle. And I thought it would be easy! Thanks for taking the trouble to reply, Sincerely Denville. "Bob Gonder" <notbg@notmindspring.invalid> wrote in message news:81g9n1tnc4hn71lnsbge6ie8osgd9mpluv@4ax.com... > Denville Longhurst wrote: > >>1. Check whether foo.exe is already running so that I don't attempt to run >>it twice; > > Use acess() to check if the file is writable. > When the program is running, it is not writable. > If the file is marked as read-only, or resides on a CD, then this > method will fail. > >>2. Spawn foo.exe > > Use CreateProcess() > >>4. From my app, terminate foo.exe > > CreateProcess() returns handles that can be used to terminate the > process. > >
Technical Details
Message-ID:
<4374e2ca@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4374b248$1@newsgroups.borland.com> <81g9n1tnc4hn71lnsbge6ie8osgd9mpluv@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d85ed3b722a8f188 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Denville Longhurst" <Denville@metco.co.uk> Newsgroups: borland.public.cppbuilder.nativeapi References: <4374b248$1@newsgroups.borland.com> <81g9n1tnc4hn71lnsbge6ie8osgd9mpluv@4ax.com> Subject: Re: Spawning and controlling Date: Fri, 11 Nov 2005 18:29:00 -0000 Lines: 36 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 80.0.6.88 Message-ID: <4374e2ca@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1131733706 80.0.6.88 (11 Nov 2005 10:28:26 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail