App Shutdown Slooooow
- From: "Norm" <NormF4@xxxxxxxxxxxxxxxxx>
- Date: Mon, 23 Apr 2007 19:37:50 -0700
Hi,
I have a Golf Handicap program that is very slow shutting down. I am using a
hotkey with three different forms and am pretty sure that Unregistering the
hotkey and Unhooking the form it where it is slowing down, but I don't know
why.
When the app opens it hooks the main form, if I shut the app down from the
main form, then only one form could have been hooked, but it still takes
about 5 seconds for the app to shutdown. I have a frmStart that does
skinning and is the first form to open and the last form to close. I have
left out the skinning and the shutdown time is still 5 seconds.
Here is the code from the Unload Event of the frmStart:
Dim vForm As Form
On Error Resume Next
Wbocx1.DetachWindow Me.HWnd
Wbocx1.UndoWB
If bShutDown Then ' this is true if command line shutdown and only
frmStart loaded
Set frmStart = Nothing
Exit Sub
End If
If Not bStart2 Then ' This is true only if user opts out of program,
before any hooked forms are loaded
If strRegHotKey = "frmMain" Then
frmMain.ResetDatabase 'this saves the user files
IsTrapping = UnregisterHotKey(frmMain.HWnd, 1) = 0
Unhook frmMain.HWnd
ElseIf strRegHotKey = "frmAdd" Then
IsTrapping = UnregisterHotKey(frmAdd.HWnd, 1) = 0
Unhook frmAdd.HWnd
ElseIf strRegHotKey = "frmMsg" Then
IsTrapping = UnregisterHotKey(frmMsg.HWnd, 1) = 0
Unhook frmMsg.HWnd
End If
End If
bStart2 = False
'Cleaning up any temp files
Kill App.Path & "\tmpfile.$$$"
Kill App.Path & "\Help.txt"
Kill App.Path & "\BackupData.txt"
Kill sTemp & "ver.txt"
Kill App.Path & "\Update.exe"
'writing last user to registry
fWriteValue "HKCU", SecRep, "LastUser", "S", strNames
'Closing all open forms
For Each vForm In Forms
If vForm.Name <> frmStart.Name Then
Unload vForm
Set vForm = Nothing
End If
Next
Set frmStart = Nothing
I would appreciate any suggestions or other ways to do this.
Thanks,
Norm
.
- Follow-Ups:
- Re: App Shutdown Slooooow
- From: Karl E. Peterson
- Re: App Shutdown Slooooow
- From: Michael C
- Re: App Shutdown Slooooow(solved)
- From: Norm
- Re: App Shutdown Slooooow
- Prev by Date: Re: SAP Exchange ?
- Next by Date: Re: App Shutdown Slooooow(solved)
- Previous by thread: Moving groups
- Next by thread: Re: App Shutdown Slooooow(solved)
- Index(es):