trap window close

trap window close

Post by Martin » Sat, 24 Jul 2004 21:39:57


anybody who knows how to trap when a window is closed (X) ??

i was hoping there is another event than the form_terminate or form_unload.

thanks

martin!
 
 
 

trap window close

Post by Adrian Bir » Sat, 24 Jul 2004 22:06:29


Martin,

From a simple test, it looks like it goes through the unload then the
terminate events and doesn't touch the deactivate one at all.

Ade

 
 
 

trap window close

Post by Satan's Ev » Sat, 24 Jul 2004 22:13:53

There is also the Form_QueryUnload event. This event allows you to cancel
the unload if required.




form_unload.
 
 
 

trap window close

Post by Martin » Sun, 25 Jul 2004 02:14:19


thanks alot, this was indeed the right way.
searching on queryunload i found a nice example:

Private Sub Form_QueryUnload(Cancel As Integer, _
UnloadMode As Integer)
Select Case UnloadMode
Case vbFormControlMenu ' = 0
' Form is being closed by user.
Case vbFormCode ' = 1
' Form is being closed by code.
Case vbAppWindows ' = 2
' The current Windows session is ending.
Case vbAppTaskManager ' = 3
' Task Manager is closing this application.
Case vbFormMDIForm ' = 4
' MDI parent is closing this form.
Case vbFormOwner ' = 5
' The owner form is closing.
End Select
End Sub


martin!