I'm having a problem with a VB6 app locking up when it is shutdown via the Windows Restart Manager. This is very visible when using the new Restart Manager support in Inno setup and even occurs with an empty VB6 project compiled.
When I've added logging to the QueryUnload
and Unload
event, I see the following sequence:
QueryUnload(vbAppWindows)
Unload()
QueryUnload(vbAppTaskManager)
After this, the VB6 process seems to lock up inside the VB6 runtime and the process calling the Restart Manager eventually times out and gives up.
A similar problem has been reported before buit with no sensible resolution.
There were discussions on this in 2007 on the Windows Application Compatability forums.
The proposed solution was to add this to the end of the QueryUnload
event handler of your main form:
'For Vista Certification requirement.
'Handles TEST CASE 30. Verify the application is Restart Manager Aware.
If UnloadMode = vbAppWindows Then Unload Me
It seems that the VB6 runtime isn't handling one of the shutdown messages correctly and so the Restart Manager then sends a more forcable close message causing the runtime to lock up.
I have confirmed this fix with a fairly complex, multi process VB6 application and it all shuts down correctly with no obvious untoward affects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With