Tough Guru test on children 
Author Message
 Tough Guru test on children

Ok, here is what I think is a tough one.

I have a program that attaches and maps drive letters on Novell. The program
then "watches" to see when the program terminates and then kills the network
connection. Everything is working fine.

However, there are a couple of programs that "span" another program. Here is
what happens:

Myprogram connects maps a drive
Program1 is started
Program2 is started from Prog1
Program1 ends
Myprogram sees Program1 ended and unattaches network server
Program2 is left{*filter*} with the drive mapping gone

QUESTIONS:
How can I find out if Program1 starts another program?
Is there a way to get a winhandle or something?
Would Program2 be concidered a "child" window?



Sun, 08 Mar 1998 03:00:00 GMT  
 Tough Guru test on children

Quote:

>Ok, here is what I think is a tough one.

>I have a program that attaches and maps drive letters on Novell. The program
>then "watches" to see when the program terminates and then kills the network
>connection. Everything is working fine.

>[snip]

>QUESTIONS:
>How can I find out if Program1 starts another program?
>Is there a way to get a winhandle or something?
>Would Program2 be concidered a "child" window?

    I don't believe Program2 could be considered a child window.
A Shelled program (even if it's done with the WinExec API function)
is a task independent of the Shelling program.

    Finding out whether any given program starts another
would be very tough indeed, if possible.  I don't have any ideas
for you there but would be interested in hearing about any that
come your way since I do a lot of programming along this line.

    Perhaps you could scan through the task list using the
GetModule... API functions, obtaining the program paths to determine
whether there are any additional programs running from a given
resource before you disconnect it.  This would also cover those
situations where you happen to have more than one program running
from a given resource without them being otherwise related.

    Cordially,
    Bob Moss



Sun, 08 Mar 1998 03:00:00 GMT  
 Tough Guru test on children

Quote:

>Ok, here is what I think is a tough one.

        Right.

Quote:
>QUESTIONS:
>How can I find out if Program1 starts another program?

        No way. We had this problem a kopla years
        ago; lucky enough, all 3 pgms were made by
        ourselves, so we were able to tune them.

Quote:
>Is there a way to get a winhandle or something?

        You can have a polling loop that looks for
        Program2's window (FindWindow) if you know
        its title. A neat place might be the
        GetModuleUsage(Program1) loop. If you run
        Program1 asynchronously then I'm afraid
        you're lost in space/time...

Quote:
>Would Program2 be concidered a "child" window?

        Hardly.

Greetings,

 ----------------------------------------
| I don't believe in a no-win scenario.  |
|               - Admiral James T. Kirk  |
 ----------------------------------------



Mon, 09 Mar 1998 03:00:00 GMT  
 Tough Guru test on children

Quote:


>Subject: Tough Guru test on children
>Date: 20 Sep 1995 14:13:32 GMT
>Ok, here is what I think is a tough one.
>I have a program that attaches and maps drive letters on Novell. The program
>then "watches" to see when the program terminates and then kills the network
>connection. Everything is working fine.
>However, there are a couple of programs that "span" another program. Here is
>what happens:
>Myprogram connects maps a drive
>Program1 is started
>Program2 is started from Prog1
>Program1 ends
>Myprogram sees Program1 ended and unattaches network server
>Program2 is left{*filter*} with the drive mapping gone
>QUESTIONS:
>How can I find out if Program1 starts another program?
>Is there a way to get a winhandle or something?
>Would Program2 be concidered a "child" window?

Should program1 close program2 when it closes? It so, have program1 shut down
program2. If not, have Myprogram monitor program1 and program2. You will have
to check to see if either program is running first though.
Chris S. Newell
Univ. of Missouri-Columbia
Dept. of Telecommunications
5 Telecom. Bldg.
Columbia, Mo. 65211
(314)882-2762



Tue, 10 Mar 1998 03:00:00 GMT  
 Tough Guru test on children

writes:

Quote:
> ...
> QUESTIONS:
> How can I find out if Program1 starts another program?

Have you tried the TaskFirst(), TaskNext() calls in the ToolHelp library?
They return a TASKENTRY structure that contains a thing called hTaskParent.
You never know but Windows may retain the relationship between parent and
child task in there(?)

--
Steve Lewis, Smartware Ltd., UK



Thu, 12 Mar 1998 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST

2. tough question for gurus!

3. Tough question for a guru

4. Very tough question for Gurus!

5. Very tough question for Gurus!

6. Test Date -- a tough one!

7. Creating TEST environment - Need Guru Help

8. Creating TEST environment - Need Guru Help

9. Creating TEST environment - Need Guru Help

10. Test for VB Guru's

11. TEST TEST TEST TEST

12. alt.test,comp.test,misc.test,news.test

 

 
Powered by phpBB® Forum Software