Results 1 to 10 of 10

Thread: [SOLVED] Program doesn't really exit after unload process

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Resolved [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 I tried many suggestions that I found, but none of them solves this problem
    So, does anyone from here know solution? Thanks in advance!
    Last edited by MikiSoft; Jan 15th, 2013 at 07:56 PM. Reason: Problem solved!

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,346

    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.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    gibra
    Guest

    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

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    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.

  5. #5
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,371

    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.

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    13,343

    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.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Program doesn't really exit after unload process

    Quote Originally Posted by Bobbles View Post
    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 View Post
    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.
    Last edited by MikiSoft; Jan 15th, 2013 at 06:26 PM.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    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!
    Last edited by MikiSoft; Jan 15th, 2013 at 07:49 PM.

  9. #9
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,346

    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?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: Program doesn't really exit after unload process

    Quote Originally Posted by Nightwalker83 View Post
    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width