Well when the Master Form is Unloaded, there is a battle inside the SystemTray to unload it, from there and memory processes. I mean that all of the SystemTray Icons flicker and move around. Then it is up to the TaskManager to remove it from the processes. That is the only way that I can remove it from memory, the hard way, in fact of the matter...
Problem: It works alright when the Console App, has not logged into anything or even being used for anything. Eg: When you execute it and then just exit out of it right away. However when you use it then it wouldn't let you remove it from memory. This means that there is something that is still running. I have been able to totally unload all of the Forms, and then there aren't any Control Arrays, therefore that wouldn't count for anything in this application of mine. However there aren't many If statements. Please note, that they have all been written using the ElseIf for multipul types of conditions in the structure of the code block. Followed by there aren't any For ... Next loops, at all in the whole application of mine. Therefore I am asking someone's help in this matter. Also there is a Winsock Control, that I always close off, using the .Close property in the code, in the end of the Form
_Unload Handler, which is found inside the Master Form's Unload Handler...
This is the Master Form's Unload Handler:
Code:
Public Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Cancel = 1
Dim objForm As Form
Dim fsObject As FileSystemObject
Set fsObject = New FileSystemObject
fsObject.DeleteFolder ("c:\temp\project1")
Kill ("c:\temp\tempdata1.dat")
Set fsObject = Nothing
Call Shell_NotifyIcon(DeleteIcon, Data)
frmMain.Winsock1_Client.Close
For Each objForm In Forms
If objForm.hWnd <> Me.hWnd Then
Unload objForm
Set objForm = Nothing
End If
Next objForm
Unload Me
End
End Sub