🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Start a Child Application in a Window

#2090
From: David
Date: Wed, 02 May 2007 09:41
69 lines
3478 bytes
Remy,

Thanks. 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(). Is it possible that the new process was 
created as a child of something? I was running the test from the IDE. If so, 
is there a better way than enumerating all the child processes of each top 
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 - hardly sophisticated practice. Is 
this a bug in the header files or am I missing something obvious?

Regards,

David



"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:4630dd2e@newsgroups.borland.com...
>
> "David" <david@pedley.ws> wrote in message
> news:46306533$1@newsgroups.borland.com...
>
>> Is it possible to create a new process within (limited to) a given
>> window of a running process - like for instance, Adobe Acrobat
>> starting up to display a .pdf within Internet Explorer?
>
> Acrobat implements an ActiveX control that IE loads to display pdf
> files.  It does not load the main Acrobat application and then
> position it inside the IE window.  The ActiveX control handles the
> display internally.
>
>> What I am hoping to do is to display files of different types from
> an
>> archive within the window of a vcl control, using their varying
> display
>> applications.
>
> Unless those applications implement their own containable ActiveX
> controls like Adobe does, then your only option is to start an
> application, then manually find its window(s), such as with
> EnumWindows() and GetWindowThreadProcessId() (use CreateProcess()
> instead of ShellExecute() in order to get the thread and process IDs
> of the application), and then use SetParent() to manually set them as
> children for your own UI window.
>
>> I have tried ShellExecute with the window parameter set to the
>> handle of an existing control but this does not seem to help.
>
> That is not what the hwnd parameter of ShellExecute() is for.
>
>
> Gambit
>
> 
Technical Details
Message-ID: <46385cda$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46306533$1@newsgroups.borland.com> <4630dd2e@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: "David" <david@pedley.ws>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <46306533$1@newsgroups.borland.com> <4630dd2e@newsgroups.borland.com>
Subject: Re: Start a Child Application in a Window
Date: Wed, 2 May 2007 10:41:44 +0100
Lines: 71
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 91.84.8.205
Message-ID: <46385cda$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1178098906 91.84.8.205 (2 May 2007 02:41:46 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail