Solved

Exit a vb6 apps when a calling it apps closes

Posted on 2016-11-03
15
70 Views
Last Modified: 2016-11-03
Hi,

We have an apps that calls another vb6 apps passing data for processing.  Is there a way for vb6 apps to detect if the calling apps closes or no more in memory? (that way we can close the apps)
0
Comment
Question by:rayluvs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 3
15 Comments
 
LVL 4

Expert Comment

by:Chris Watson
ID: 41872268
Are you wanting to close the child application when the parent application closes, or close the parent application when the child application closes?
0
 

Author Comment

by:rayluvs
ID: 41872367
Exactly!
0
 
LVL 48

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
ID: 41872463
When the calling app closes, have it create a text file with a specific name like "CallingAppClosed" and have the other app look for that file. If found then the called app should take appropriate action and then delete the file. You could do something similar with the Registry.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:rayluvs
ID: 41872478
Yes, makes sense but that means that the apps has to be constantly searching that value in order to know that parent apps closed; thus, an another thing to consider into coding.  Is there another way, or maybe your way but to consider the apps not to be constantly looking at that value?

Please advice.
0
 
LVL 48

Accepted Solution

by:
Martin Liss earned 250 total points
ID: 41872505
The only other thing I can think of is for the calling app to kill the called app. I'm sure you can find code to do that.
0
 

Author Comment

by:rayluvs
ID: 41872532
No, of course, that part is understood, it's that your recommendation requires the apps to be constantly reading the text file to see if the user exited from the parent apps, unless we didn't understand your recommendation.

Is what you recommended requires for the child apps to constantly read the text file?
0
 
LVL 48

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
ID: 41872585
Looking for a flag in the Registry via API calls would probably be faster that looking for a file, but other than that I'm out of ideas,
0
 

Author Comment

by:rayluvs
ID: 41872600
Yes that makes sense, we go there, thanx!
0
 

Author Comment

by:rayluvs
ID: 41872604
No, wait, still have the same problem: the child apps will have to constantly look into the registry to see if the parent apps closed.
0
 
LVL 4

Assisted Solution

by:Chris Watson
Chris Watson earned 250 total points
ID: 41872623
Another option might be to examine the list of the running processes. When the process representative of the parent application is no longer present, it's time for the child application to kill itself (once it has first properly grieved for the loss of its parent, of course).
0
 

Author Comment

by:rayluvs
ID: 41872637
Yes, that is also good; all are great as a matter of fact, it's the process of constantly looking to the location to see if the parent apps closed.

Don't know if we are transferring to you guys our concern .
0
 
LVL 48

Expert Comment

by:Martin Liss
ID: 41872640
No, wait, still have the same problem: the child apps will have to constantly look into the registry to see if the parent apps closed.
Yes that's true.

You have only two options which are either having the called app constantly looking for an indicator that the calling app has closed which is time consuming, or have the calling app close the called app as I suggested in post ID: 41872505.
0
 
LVL 4

Assisted Solution

by:Chris Watson
Chris Watson earned 250 total points
ID: 41872683
If you've opened the child application in the parent application with the Shell method, which returns the child's PID, you can close the child application at will (say, before you exit the parent application) using that PID.

There's some example code to do just that at the link below.

End an Application that was Started by the Shell Function - FreeVBcode.com

I think that's the sort of thing Martin had in mind in post 41872505, if you don't want to constantly poll in the child application to see if the parent application is still running.
0
 

Author Comment

by:rayluvs
ID: 41872705
Yes, sorry guys, didn't read correct the first.  We can do that, kill the apps from the parent.

Thanx!
0
 
LVL 48

Expert Comment

by:Martin Liss
ID: 41872718
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Suggested Courses
Course of the Month6 days, 23 hours left to enroll

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question