🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

ProcessID mismatch after CreateProcess() call.

#14439
From: Mark D
Date: Thu, 14 Aug 2003 10:09
31 lines
2179 bytes
Friends

I launch an app that my app needs with a call to 
CreateProcess(). All goes well.  I extract a ProcessID from the 
newly spawned process using my instance of the 
PROCESS_INFORMATION structure: ProcInfo.dwProcessID.  It 
contains what looks like a valid ID, say 1066.

Later, when I want to close the app, I'm using EnumWindows and, 
in the callback, GetWindowThreadProcessID() to find windows 
belonging to my process:

unsigned long RetProcID=1; //ignored if NULL so init to 1
unsigned long ThreadID=GetWindowThreadProcessID(WinHandle, &RetProcID);

This callback function is correctly being passed the original 
ProcessID extracted from my ProcInfo instance.  But the RetProcID
never matches.  I know the window handle is good because as part 
of my debug I'm calling GetWindowText each time, and when the 
text is VTPLus...(the app I launched with CreateProcess)I step 
through the call to GetWindowThreadProcessID() and the IDs don't
match.

One final thing, a call to GetClassName for my valid HWND 
instance tells me the vtplus32.exe app is not of class 
TApplication but its own custom VTPlus..something class.

Any thoughts appreciated.

Mark
Technical Details
Message-ID: <3f3b5fc8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,1f2bd942df162911,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-14 03:40:53 PST
From: "Mark D" <m.davenCROPHEREport@ntlworld.com>
Sender: "Mark D" <m.davenCROPHEREport@ntlworld.com>
Reply-To: "Mark D" <m.davenCROPHEREport@ntlworld.com>
Subject: ProcessID mismatch after CreateProcess() call.
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 213.121.212.121 213.121.212.121    
X-Forwarded-For: 10.250.0.101
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3f3b5fc8$1@newsgroups.borland.com>
Date: 14 Aug 2003 03:09:12 -0700
X-Trace: newsgroups.borland.com 1060855752 207.105.83.65 (14 Aug 2003 03:09:12 -0700)
Lines: 31
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail