[comp.os.os2] HWND from PID

hdan@walt.cc.utexas.edu (Dan Higdon) (11/17/89)

Ok, all you Microsoft people out there, here's a fun one....

How can I find the Window ID of a Child process?  I can (obviously)
get the PID from my DosExecPgm call, but how can I then get a handle
on the new process's window?  I KNOW there must be a call for this,
but I can't find it in the INDEX... :-#

I know I could enumerate all the top level windows and try to find the
one I'm looking for, but that seems a little barbaric.

Another, related question:  When you ExecPgm a new process ASYC, does
it continue to run after the parent dies?  (please say yes.)

Thanks in advance for your help!

hdan@sleepy.cc.utexas.edu  (Really Dan Higdon)

jack@csccat.UUCP (Jack Hudler) (11/18/89)

In article <21069@ut-emx.UUCP> hdan@walt.cc.utexas.edu (Dan Higdon) writes:
>Ok, all you Microsoft people out there, here's a fun one....
>
>How can I find the Window ID of a Child process?  I can (obviously)
>get the PID from my DosExecPgm call, but how can I then get a handle
>on the new process's window?  I KNOW there must be a call for this,
>but I can't find it in the INDEX... :-#
>
>I know I could enumerate all the top level windows and try to find the
>one I'm looking for, but that seems a little barbaric.
>
>Another, related question:  When you ExecPgm a new process ASYC, does
>it continue to run after the parent dies?  (please say yes.)
>
>Thanks in advance for your help!
>
>hdan@sleepy.cc.utexas.edu  (Really Dan Higdon)

I don't know how to do what your asking.. but try this.

In the parent and child do:
hAtomTbl = WinQuerySystemAtomTable();
WM_Your_atom = WinAddAtom(hAtomTbl,"SOMENAMEYOUCHOOSE");

Have the child when able do a broadcast message that only the parent would know.

WinBroadcastMsg(hWnd,WM_Your_atom,MPFROMHWND(hWndChildFrame),0L,BMSG_POSTQUEUE);

And in the parent be ready to recieve the message, in this example mp1 would
contain the window handle. Once you have this a more private comunication
can take place.

-- 
Jack 		Computer Support Corportion		Dallas,Texas 
Hudler		UUCP: {texsun,texbell,attctc}!csccat!jack