Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange Problem

Status
Not open for further replies.

Monguse

Programmer
Mar 11, 2002
63
0
0
US
I have a program that is being used and I have found from time to time that on some of the work stations there is more than one copy of the program name listed in the Program Manager(Win98) and I have no idea why. When the program is closed this is the commands used to exit:

CCDoors.Close
Set CCDoors = Nothing
Unload Me
End

Am I missing something or is there another problem?

There is only one copy shown on the task bar as being open and I notice that when this happens it causes the program to do strange things. "The beauty of the second amendment is, that it will not be needed until
they try to take it." - Thomas Jefferson
 
I have encountered a similar situation, but which may not apply in your situation.

If you have multiple forms within your project, and from one form, you make an assignment to a public variable on another form, and then never actually load the other form, you end up with an orphan instance of the second form, and the prorgram never completely terminates.

Hope this helps
 
Before your "End" statement, You can use to following code to unload any forms that may still be loaded:

Dim objForm As Form

For Each objForm in Forms
objForm.Unload
Set objForm = Nothing
Next objForm


Also, in your Sub Main() as you are about to start loading up the Application, you can check for App.PrevInstance. If there is already an instance of the App running, don't allow a new instance to be started.
 
It may be simpler than that.

Also, if you're running multiple forms, check the ShowInTaskbar propery for them. Each form Showing gets an entry in the processes list.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top