“Vô hiệuhoábuttonclosevàmenucủaform (cả Alt-F4 luôn)” home Xuất xứ : www.ttvnol.com Binh khí sử dụng : Chẳng cần gì ta chỉ cần tay không bắt hổ Đoạn mã : Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long Private Const MF_BYPOSITION = &H400& Private ReadyToClose As Boolean Private Sub RemoveMenus(frm As Form, _ remove_restore As Boolean, _ remove_move As Boolean, _ remove_size As Boolean, _ remove_minimize As Boolean, _ remove_maximize As Boolean, _ remove_seperator As Boolean, _ remove_close As Boolean) Dim hMenu As Long hMenu = GetSystemMenu(hwnd, False) If remove_close Then DeleteMenu hMenu, 6, MF_BYPOSITION If remove_seperator Then DeleteMenu hMenu, 5, MF_BYPOSITION If remove_maximize Then DeleteMenu hMenu, 4, MF_BYPOSITION If remove_minimize Then DeleteMenu hMenu, 3, MF_BYPOSITION If remove_size Then DeleteMenu hMenu, 2, MF_BYPOSITION If remove_move Then DeleteMenu hMenu, 1, MF_BYPOSITION If remove_restore Then DeleteMenu hMenu, 0, MF_BYPOSITION End Sub Private Sub cmdClose_Click() ReadyToClose = True Unload Me End Sub Private Sub Form_Load() RemoveMenus Me, False, False, _ False, False, False, True, True End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Cancel = Not ReadyToClose End Sub . Vô hiệu hoá button close và menu của form (cả Alt-F4 luôn)” home Xuất xứ : www.ttvnol.com Binh. remove_seperator As Boolean, _ remove _close As Boolean) Dim hMenu As Long hMenu = GetSystemMenu(hwnd, False) If remove _close Then DeleteMenu hMenu, 6, MF_BYPOSITION If