|
-
Oct 11th, 2005, 10:55 AM
#1
Thread Starter
Fanatic Member
Application not closing properly [RESOLVED]
There's something weird happening on an application I made for a client.
Each time he close the application, it still running in the task manager.
In the IDE, it's closing properly.
I know that when an application is not closing, it means something still running in the application. I used debug.print just because the unload to see what's running.
I'm using the com port, which is closed, a timer, it's disabled and a DB connection which is closed too.
I tried to use the "End" command to completely close the app on the unload. On the IDE, it still working, but on the .exe, I get a Windows error message saying the application encountered errors and had to be closed by Windows.
How can I see why the application is not closing properly ??
Added green "resolved" checkmark - Hack
Last edited by Hack; Oct 13th, 2005 at 06:20 AM.
-
Oct 11th, 2005, 11:16 AM
#2
Fanatic Member
Re: Application not closing properly
Are you unloading all your forms? Are you opening a form then hidding it b/c you might not be unloading that one?
Using VB6 or VB.net 2008 with .net 3.5
"Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad
-
Oct 11th, 2005, 11:22 AM
#3
Re: Application not closing properly
 Originally Posted by space_monkey
Are you unloading all your forms? Are you opening a form then hidding it b/c you might not be unloading that one?
Even if he is not unloading all the forms etc. the End command should terminate the application.
It seems more of a corrupted system file issue to me.
Pradeep
-
Oct 11th, 2005, 11:24 AM
#4
Re: Application not closing properly
End is yucky. Don't use it 
VB Code:
Dim f As Form
For Each f In Forms
Unload f
Next f
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Oct 11th, 2005, 12:03 PM
#5
Thread Starter
Fanatic Member
Re: Application not closing properly
Forgot to tell you, this is something I test with Debug.Print
It returns 1, so everything is okay for the forms
-
Oct 11th, 2005, 01:33 PM
#6
Re: Application not closing properly
What about closing and destorying your objects (like recordset objects, connections objects, etc)? Is that being taken care of?
-
Oct 11th, 2005, 01:44 PM
#7
Thread Starter
Fanatic Member
Re: Application not closing properly
I always close recordsets and connections.
I'll check if I forgot something, but I don't think that's the problem
-
Oct 11th, 2005, 01:45 PM
#8
Re: Application not closing properly
In your first post you said this was an application you made for a client.
Is this only happeing on his machine or it happening no matter where you run it?
-
Oct 11th, 2005, 03:07 PM
#9
Thread Starter
Fanatic Member
Re: Application not closing properly
I didn't try it on other computer.
What I did now, I'm creating a txt file on MDIForm_Unload that show the state of DB connection, COM Port, # of Forms, ...
This way, I'll see where's the problem
-
Oct 11th, 2005, 03:10 PM
#10
Fanatic Member
Re: Application not closing properly
Gensor, can you post the code or something? So I can take a look at it? I had a problem like this becuase I was using the form resize but by accident, didnt spell the form name correct and it never closed when running the exe.
-
Oct 11th, 2005, 03:18 PM
#11
Thread Starter
Fanatic Member
Re: Application not closing properly
Actually, I can't. I know it would be the best way, but first, it's a big application and second, it's in French, so all variables, functions and subs are in French and third, it's a question of privacy. I'm not allowed to show or give source code. My boss would'nt like me if I do that
-
Oct 11th, 2005, 03:28 PM
#12
Re: Application not closing properly
Gensor,
You know that's like going to the doctor and telling him:
Doc, I have a pain and I don't like it... But I am not going to tell or show you where.
And then expecting him to diagnose and fix the problem properly.
-
Oct 11th, 2005, 03:46 PM
#13
Fanatic Member
Re: Application not closing properly
Nice analogy randem.
-
Oct 11th, 2005, 05:14 PM
#14
Re: Application not closing properly
 Originally Posted by neicedover1982
..... but by accident, didnt spell the form name correct and it never closed when running the exe.
Option Explicit will fix that... Always use Option Explicit !
-
Oct 11th, 2005, 07:17 PM
#15
Thread Starter
Fanatic Member
Re: Application not closing properly
randem
If you did something really stupid and hurt yourself. You'll be too shy to tell it to someone, so, you'll say to the doctor where you're harm, but you'll never tell him how you did to hurt yourself!!
-
Oct 11th, 2005, 07:30 PM
#16
Fanatic Member
Re: Application not closing properly
somewhere in your code you have managed to create a circular reference - and this what is keeping your app running.
your job - find that reference.
-
Oct 11th, 2005, 07:34 PM
#17
Thread Starter
Fanatic Member
Re: Application not closing properly
I don't understand what you mean by circular reference !!
-
Oct 11th, 2005, 07:49 PM
#18
Re: Application not closing properly
Put a timer on each for for each minute..have it open the app.path & "\info.txt" for instance..
then have it print the timers form and when you close your app, you will see which form(s) are hanging
-
Oct 11th, 2005, 11:59 PM
#19
Re: Application not closing properly
Gensor,
The doctor would have to see the wound, wouldn't he. You have to show us yours. Post some code or we are just guessing. When it could be obviously clear if we saw some code. Your code can't be so scrective that a excerpt of your code would cause a national security alert.
-
Oct 12th, 2005, 12:15 AM
#20
Re: Application not closing properly
You might have missed something that was very easy to overlook. Posting some code can't hurt. Extra eyes can always help.
-
Oct 12th, 2005, 09:30 PM
#21
Fanatic Member
Re: Application not closing properly
-
Oct 12th, 2005, 09:53 PM
#22
Thread Starter
Fanatic Member
Re: Application not closing properly
I don't mind to post some code, but for this problem, I would have to post all the application. Posting a part of the application won't help you!
-
Oct 12th, 2005, 09:55 PM
#23
Re: Application not closing properly
Gensor,
So posting none will help HOW?
-
Oct 12th, 2005, 09:57 PM
#24
Thread Starter
Fanatic Member
Re: Application not closing properly
I thought you would know by experience what are the common problems when an application is not closing properly.
-
Oct 12th, 2005, 10:11 PM
#25
Re: Application not closing properly
Gensor,
Experience is what make us ask for the code. If everyone coded the same you would not have this problem in the first place. That is why we need to see actual code. Common problems have been given to you. Unfortunately, coders find new ways to create old errors.
-
Oct 12th, 2005, 10:11 PM
#26
Re: Application not closing properly
Search for 'not closing' and you'll see that the answers are all the same. Usually requires posting the code in question, as we can't read minds.
-
Oct 12th, 2005, 10:15 PM
#27
Thread Starter
Fanatic Member
Re: Application not closing properly
I'll try to figure it out by myself.
So this is thread is now resolved
-
Oct 12th, 2005, 10:17 PM
#28
Re: Application not closing properly [RESOLVED]
Post back when you figure it out.
-
Oct 12th, 2005, 10:21 PM
#29
Thread Starter
Fanatic Member
Re: Application not closing properly [RESOLVED]
-
Oct 13th, 2005, 12:51 PM
#30
Re: Application not closing properly [RESOLVED]
Gensor,
Did you by anyway miss my post no. 3.
I'm 99% sure the problem is not with your application, but with the OS/ extenal factors. The END statement terminates the application instantly & unconditionally (though I won't recomment using it). So whether it is a circular reference or resources not released, this problem shouldnot occur.
The surest way to confirm what I said is to try your app on another system. In case the problem is still there, your program is to be blamed, incase the problem goes away your OS is to be blamed.
Pradeep
-
Oct 13th, 2005, 01:32 PM
#31
Thread Starter
Fanatic Member
Re: Application not closing properly [RESOLVED]
Actually, I tried it first with a Windows 2000 computer. And now, I have a new computer which have Windows XP on it and I still got a GPF when ending the program with End.
-
Oct 13th, 2005, 01:38 PM
#32
Re: Application not closing properly [RESOLVED]
Gensor,
Never use end. It is only there to terminate a specific portion of your app not all of it. It basically there for novices. There are independent portion of you app that you can start active such as API calls, other dll's or objects. You must terminate all processes and objects before terminating your app. End just does not do it!!!!
-
Oct 13th, 2005, 05:16 PM
#33
Thread Starter
Fanatic Member
Re: Application not closing properly [RESOLVED]
I know, I usually don't use End.
I only tried it to see if it would close correctly.
-
Oct 13th, 2005, 05:36 PM
#34
Re: Application not closing properly [RESOLVED]
If you want to PM me with your email address, I'll reply with mine, and I will look at it, and keep it confidential. If I have any questions, I'll post them here, after PM'ing you with my thoughts.
Let's see if we can solve the problem, and produce a good thread for others!
-
Oct 13th, 2005, 07:36 PM
#35
Thread Starter
Fanatic Member
Re: Application not closing properly [RESOLVED]
That's a good idea, but I want to wait first.
I modified my application to create a log file to show me what is still open when the application unloads.
If I don't find what's the problem with the log file, I'll PM you my e-mail.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|