使窗体上的关闭按钮失效

来源:岁月联盟 编辑:zhu 时间:2004-11-17
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