Article View: borland.public.cppbuilder.nativeapi
Article #1997Re: Start a Child Application in a Window
From: Remy Lebeau (TeamB)
Date: Wed, 02 May 2007 17:00
Date: Wed, 02 May 2007 17:00
50 lines
2504 bytes
2504 bytes
"David" <david@pedley.ws> wrote in message news:46385cda$1@newsgroups.borland.com... > I have tried using EnumWindows() and GetWindowThreadProcessId() > to enumerate all of the 'top level' threads/processes active on the workstation > (a large number). However, none of these matches the thread or process ids > returned by the CreateProcess(). Yes, they will. Please show your actual code. I would also suggest calling WaitForInputIdle() before calling EnumWindows(), to give the new process some time to create and show its windows. > Is it possible that the new process was created as a child of something? > I was running the test from the IDE. No. That wouldn't matter anyway, since you have the IDs of the new process itself. Each window belongs to a specific process, even if it were a child process. > Incidentally, had somewhat of a struggle to get the callback to > EnumWindows() working. The first parameter of EnumWindows > is a pointer to the callback routine which is defined as > WNDENUMPROC, which in turn is defined as > > int __stdcall CbFunction () > > whereas the callback routine required is actually > > int __stdcall CbFunction (HWND w, LPARAM parm) > > This means defining the latter and casting its pointer to the former > when specifying the EnumWindows parameter Yes. > hardly sophisticated practice. No, but it is required practice in this particular case. Just one of many quirks in how the Win32 API operates in general. > Is this a bug in the header files No. Gambit
Technical Details
Message-ID:
<4638c3b5$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46306533$1@newsgroups.borland.com> <4630dd2e@newsgroups.borland.com> <46385cda$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5166d27047cb5dc0 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <46306533$1@newsgroups.borland.com> <4630dd2e@newsgroups.borland.com> <46385cda$1@newsgroups.borland.com> Subject: Re: Start a Child Application in a Window Date: Wed, 2 May 2007 10:00:33 -0700 Lines: 52 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.82.60.244 Message-ID: <4638c3b5$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1178125237 75.82.60.244 (2 May 2007 10:00:37 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail