Solved

Exit a vb6 apps when a calling it apps closes

Posted on 2016-11-03
15
33 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
  • 7
  • 5
  • 3
15 Comments
 
LVL 4

Expert Comment

by:Chris Watson
Comment Utility
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
Comment Utility
Exactly!
0
 
LVL 45

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
Comment Utility
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
 

Author Comment

by:rayluvs
Comment Utility
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 45

Accepted Solution

by:
Martin Liss earned 250 total points
Comment Utility
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
Comment Utility
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 45

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:rayluvs
Comment Utility
Yes that makes sense, we go there, thanx!
0
 

Author Comment

by:rayluvs
Comment Utility
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
Comment Utility
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
Comment Utility
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 45

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
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
Comment Utility
Yes, sorry guys, didn't read correct the first.  We can do that, kill the apps from the parent.

Thanx!
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now