日期:2009-06-06  浏览次数:20410 次

Const vbFormControlMenu=0 'User has chosen Close command from Control menu box on form

Const vbFormCode=1 'Unload method invoked from code
Const vbAppWindows=2 'Current Windows session ending
Const vbAppTaskManager=3 'Windows Task Manger is closing the application
Const vbFormMDIForm=4 'MDI child form is closing because the MDI form is closing
vbFormOwner=5 'The owner of the form is closing


Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbFormControlMenu Then
Cancel = True
End If
End Sub