Защита приложения от выключения через ctrl+alt+del - VB
Формулировка задачи:
Как генерировать чтоб приложение нельзя было выключить при помощи клавиш ctrl+alt+del? помогите кто может.
Решение задачи: «Защита приложения от выключения через ctrl+alt+del»
textual
Листинг программы
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long Sub DisableCtrlAltDelete(bDisabled As Boolean) Dim X As Long X = SystemParametersInfo(97, bDisabled, CStr(1), 0) End Sub 'Usage: 'To disable Ctrl-Alt-Delete: Call DisableCtrlAltDelete(True) 'To enable Ctrl-Alt-Delete: Call DisableCtrlAltDelete(False) --------------------------------- Вот ещё пример, как заблокировать крестик (X) и др. на форме ---------------------------- Option Explicit 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 ' Get the form's system menu handle. 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() ' Remove the Close system menu item and the ' menu separator. RemoveMenus Me, False, False, _ False, False, False, True, True End Sub ' Cancel if ReadyToClose is false. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Cancel = Not ReadyToClose End Sub
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д