Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A VB6 application locks up when shut down via the restart manager

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.

like image 531
Deanna Avatar asked Oct 16 '25 16:10

Deanna


1 Answers

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.

like image 120
Deanna Avatar answered Oct 19 '25 14:10

Deanna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!