DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: App. continues to run even after Exit

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    App. continues to run even after Exit

    [Originally posted by Bobby]

    My database application( exe file ) continues to run in the background even after exiting from the application.( I'm closing all the recordsets/connection...setting them to nothing when the app. exits.)
    How do i stop this excecution? It utilizes CPU resources as seen on Task Manager.
    Is something required to be done while creating the package?

    Any help would be appreciated
    Thanks
    Bobby

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:App. continues to run even after Exit

    [Originally posted by neophile]

    Are you sure you're unloading/terminating all event-driven objects? This could be anything from Forms or Class Objects to particular ActiveX controls or ActiveX DLL/EXE referenced-objects.

    So what I usually do is put something like this in my main form (Form_Unload) or module (custom "EndApp" routine)...

    Dim frmTmp As Form
    For Each frmTmp In Forms
    Unload frmTmp
    Next
    If Forms.Count > 1 Then Cancel = True ' If this is a Form
    If Forms.Count = 0 Then End ' If this is a module


    ...also make sure that for every...

    Dim MyObj As SomeObject
    Set MyObj = New SomeObject

    ...you have an accompanying...

    Set MyObj = Nothing

    ...when you're done with it.


    This should fix it, unless it's something specific to a referenced object that's misbehaving.

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:App. continues to run even after Exit

    [Originally posted by Tich]

    If you have a link to another object in your code and that object has a link to you, your 'terminate' code will not execute as your 'link-count' is not zero, you have to set the links to Nothing first.

    If you were using a form and have code in your Terminate event, try moving the code to the 'unload' event and see if that helps?

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:App. continues to run even after Exit

    [Originally posted by shardul soman]

    Hi,
    I think you are using the EXIT keyword..instead use the END keyword..
    bye for now,
    Shardul.

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:App. continues to run even after Exit

    [Originally posted by Jose Sanchez]

    Your app is running a do...loop
    or for ...next while you click exit...
    Try this:
    Sub Form_QueryUnload()
    'close recordsets..databases....
    end
    end sub

    end will 'end' your app
    it is supossed end will close all
    open recordsets and databases but it is more
    polite to close then before call end statement.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center