🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #9001

Re: Process ID

#9001
From: Ed Mulroy [TeamB]
Date: Mon, 16 Aug 2004 10:28
22 lines
1690 bytes
The easiest way is to change the code to start it with CreateProcess 
or with ShellExecuteEx so that you already have the process id when 
the call finishes.

If you know the caption of the window that the program you are 
launching and it is unique you could use FindWindow to get the window 
handle (the HWND) and then call GetWindowThreadProcessId

If you can't do either of the above then look at the set of functions 
CreateToolhelp32Snapshot, Process32First,  Process32Next and 
CloseHandle.

.  Ed

zoom wrote in message
> news:41208174$1@newsgroups.borland.com...
> How to get the process ID of the program started by the following 
> line of
> code
>
> ShellExecute(Handle, "open", "c:\\Windows\\notepad.exe", NULL, NULL,
> SW_SHOWNORMAL);
Technical Details
Message-ID: <41208c52@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41208174$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,55da334e6f257007
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy [TeamB]" <dont_email_me@invalid.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <41208174$1@newsgroups.borland.com>
Subject: Re: Process ID 
Date: Mon, 16 Aug 2004 06:28:06 -0400
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 12.161.27.55
Message-ID: <41208c52@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1092652114 12.161.27.55 (16 Aug 2004 03:28:34 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail