09-03-16, 12:30 AM
أهلا أخي الكريم , تعديل الكود السابق , أنت ضعه بهذه الطريقه لأي محاولة لإغلاق برنامجك :
وهذا الكود إضافة فقط إذا أردت أن تعرف من الذي يحاول أو ماهي طريقة إغلاق برنامجك :
PHP كود :
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = -1
' ضع الكود الذي تريد تنفيذه قبل إغلاق البرنامج
End
End Sub
وهذا الكود إضافة فقط إذا أردت أن تعرف من الذي يحاول أو ماهي طريقة إغلاق برنامجك :
PHP كود :
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = -1
Select Case UnloadMode
Case vbFormControlMenu
MsgBox "The user chose the Close command (the ""X"") from the Control menu on the form."
Case vbFormCode
MsgBox "The Unload statement is invoked from code."
Case vbAppWindows
MsgBox "The current Microsoft Windows operating environment session is ending."
Case vbAppTaskManager
MsgBox "The Microsoft Windows Task Manager is closing the application."
Case vbFormMDIForm
MsgBox "An MDI child form is closing because the MDI form is closing."
Case vbFormOwner
MsgBox "A form is closing because its owner is closing."
End Select
'ضع كودك هنا
End
End Sub

