[SOLVED] Program doesn't really exit after unload process
Hi,
I'm using in my application "CSocketPlus" (Winsock replacement) and "NotifyIcon" (tray) modules, and in Unload sub I properly unload Socket and remove icon from tray before "End" command, but problem is that program stays in memory until I launch Task Manager :confused: I tried many suggestions that I found, but none of them solves this problem :(
So, does anyone from here know solution? Thanks in advance!
Re: Program doesn't really exit after unload process
I hope you are not using the keyword "End" to close your program? Read posts #10 and #13 here.
Re: Program doesn't really exit after unload process
The End statement should never be used, except for reasons really serious.
If your application stay in memory means that not all component are been properly released.
Paradoxically End may be the cause of the problem.
On the main form you should ensure to unload all forms, use a routine like this to release all forms:
Code:
Private Sub CloseAllForms()
Dim f As Form
For each f in Forms
If f.Name <> Me.Name Then
Unload f
End If
Next
End Sub
Re: Program doesn't really exit after unload process
I already tried that, and it didn't solve problem :( With that code, program won't exit even if I start Task Manager.
Re: Program doesn't really exit after unload process
Knock up a small program, or heavily prune a copy of your existing program, only having the likely suspects in that small program.
Run that and report back (and maybe attach it ?).
When you said Opening Task Manger ended something, did you mean to say that you opened Task Manager then killed the process ?
You should try to be as clear and specific as possible, with your posts.
Re: Program doesn't really exit after unload process
As mentioned by others you should not use the End statement at all.
If your program fails to unload completely then that indicates that somewhere in your code you have loaded and object that is not being properly unloaded,
I've never worked with cSocket so I can't say if that may cause this problem or not.
That said since you have not told us what your program is doing nor shown any code there is not much we can do.
Re: Program doesn't really exit after unload process
Quote:
Originally Posted by
Bobbles
Knock up a small program, or heavily prune a copy of your existing program, only having the likely suspects in that small program.
Run that and report back (and maybe attach it ?).
OK, I will do that.
Quote:
Originally Posted by
Bobbles
When you said Opening Task Manger ended something, did you mean to say that you opened Task Manager then killed the process ?
You should try to be as clear and specific as possible, with your posts.
No, I meant from moment when I open Task Manager, it ends automatically. I'm sorry that I haven't specified that.
Re: Program doesn't really exit after unload process
I solved problem! :)
First, you were right (of course) - problem was with "End" command because with that, program doesn't properly unload from memory. But second problem was with one currently loaded form - I put in that form not to unload when user clicks on 'X' button, and when I close main form, that form still remain loaded in memory because of that. I have fixed now that and it works.
Thanks to all people that tried to help me! :wave:
Re: Program doesn't really exit after unload process
Have you got any hooks in your program that might be detecting if the task manager is open?
Re: Program doesn't really exit after unload process
Quote:
Originally Posted by
Nightwalker83
Have you got any hooks in your program that might be detecting if the task manager is open?
No, because there's no need for that.