unloading child with parent

conniek
05-10-2001, 08:18 AM
I have set my vb program to be a child of an off-the shelf contact management program called GoldMine. When I close the parent, my program seems to go away but it is actually still running and I can see it in task manager. How can I tell my program to end with the parent without being able to change the programming of the parent itself?

JDT
05-10-2001, 10:13 AM
I think the FindWindowEx API will search child windows. Once you find it you could use SendMessage or PostMessage to close it.

The example in <a href = "http://www.visualbasicforum.com/bbs/showthreaded.php?Cat=&Board=visbas&Number=23951&Search=true&Forum=visbas&Words=end%20task&Match=Entire%20Phrase&Searchpage=0&Limit=25&Old=1month&Main=23948"> this post</a> does not use FindWindowEx but it *might* be able to do what you want if you modify it some. When I get back to my files I'll see if I can find an example of FindWindowEx to show you.


Also make sure you do not have any loops or timers running in your side of the program. This could keep the app going. End all loops, set timers enabled property to false, and maybe use the End statement.

JDT

conniek
05-10-2001, 09:43 PM
I understand FindWindowEx, but I can't modify the parent to look for the child. I can only modify the child to look for the parent. But when the parent closes, it *kind of* closes the child - the form disappears - but according to Windows it is still running. I tried looking for the parent and ending when it is not running, but since it isn't really running at that point, nothing happens.

I'm thinking that maybe a second app that just looks for the parent and unloads the child when it can't find the parent???

BillSoo
05-10-2001, 11:44 PM
How about putting an END in the child's form unload event.

Alternatively, have a timer loop that will look for the parent. If it doesn't see it, then END.

Normally, using END indiscriminately is bad, but it sounds like it may be required here....


"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum