VB6 app refuses to shut down in WinXP 
Author Message
 VB6 app refuses to shut down in WinXP

I'm having a weird problem with my application and XP.  I recently moved
from Win2k Pro to WinXP Pro on my development machine.  When I try to run my
VB app (which worked perfectly fine in Win2k and still does!) it refuses to
shut down.  If I exit it, it appears to go away but a check of the Task
Manager shows it's sitting there Not Responding.  Maybe it's something in
the code I figure, so I fire up VB and try to debug it and when it
terminates, OR I terminate it OR I stop the de{*filter*} it hangs VB!  I've
stepped through the de{*filter*} to see what's going on and it works fine till
it hits Unload in my code then it just falls off the world (note: ALL of my
cleanup code is done by this point and the VB DLL SHOULD shut me down).  The
only way I can shut it (and VB once it gets in this mess) is through the
Task Manager.  I'd hate to have to tell my users that the way to terminate
the application in XP is to use the Task Manager!

Has anyone seen anything like this?  I've checked MS and the newsgroups but
I haven't found anything remotely like this.

Thanks!



Thu, 23 Sep 2004 23:18:23 GMT  
 VB6 app refuses to shut down in WinXP
Are you logging *every* Initialize and Terminate Event in every Form,
Class and Usercontrol ?  

The method I use is to call a routine in a .BAS module with the name
of the Object (eg: frmMain) the routine allocates a unique number and
returns it to the caller - and appends the name to a list

In the Terminate event the Object calls another routine in the same
.BAS module that uses the unique ID to remove the name for the list.

This means that at any point one can call a procedure that pops up a
list of all Objects that are 'alive'
- profoundly handy for identifying things that do not 'die'
- also useful for seeing what is alive at any point in time
- and its order of creation.

Another thing (that I nicked from Delphi) is to give every Form, Class
and Usercontrol a 'Free' method

This turns off all timers, suppresses all RaiseEvents, calls the Free
method of all sub objects, sets them to nothing and destroys any other
'references' that might be{*filter*} around.  
Just for good measure (and it is not really needed) I also destroy all
Arrays.

Also - all VB DLLs and OCXes that you create are also Objects - and
need to be destroyed.
This can be a bit more tricky as you do not really want to raise an
event from within the Terminate Event of (say) a Usercontrol packaged
as an OCX

Just because 'Cleanup' code is executed does not mean that it actually
worked.

These things can be a real {*filter*} to track down - from painful
experience I have found it better to build this stuff in from the
beginning rather than add it when the App misbehaves.

HTH



Quote:
>I'm having a weird problem with my application and XP.  I recently moved
>from Win2k Pro to WinXP Pro on my development machine.  When I try to run my
>VB app (which worked perfectly fine in Win2k and still does!) it refuses to
>shut down.  If I exit it, it appears to go away but a check of the Task
>Manager shows it's sitting there Not Responding.  Maybe it's something in
>the code I figure, so I fire up VB and try to debug it and when it
>terminates, OR I terminate it OR I stop the de{*filter*} it hangs VB!  I've
>stepped through the de{*filter*} to see what's going on and it works fine till
>it hits Unload in my code then it just falls off the world (note: ALL of my
>cleanup code is done by this point and the VB DLL SHOULD shut me down).  The
>only way I can shut it (and VB once it gets in this mess) is through the
>Task Manager.  I'd hate to have to tell my users that the way to terminate
>the application in XP is to use the Task Manager!

>Has anyone seen anything like this?  I've checked MS and the newsgroups but
>I haven't found anything remotely like this.

>Thanks!



Fri, 24 Sep 2004 17:13:10 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Shut down, how to intercept shut down?

2. Shutting down an NT app from another app

3. Shutting Down a Win App

4. VB5 app stops Windows shutting down

5. How to shut down running app and automatically start a new one

6. Shutting down the PC on exiting a VB app

7. shutting down windows from app?

8. Shutting Down other Apps

9. Shutting down app's

10. Why does my VB5 app not shut down?

11. Shutting Down COM+ App From Command Line.

12. Problem shutting down VB App after establishng connection

 

 
Powered by phpBB® Forum Software