hey guys....
does anyone here knows how to disable and enable CTRL, Alt, windows keys, or Tab key in keyboard?...

because im going to use it in my time cafe client project in vb...

Try the following:

In a module add the following decleration -

Public Sub DisTaskMngr(Do_It As Boolean)
'U Can Change The Win Path To Fit Ur Need
If Do_It = True Then
FileCopy "C:\WINDOWS\system32\taskmgr.exe", "c:\taskmgr.exe"
Kill "C:\WINDOWS\system32\taskmgr.exe"
Else
FileCopy "C:\taskmgr.exe", "C:\WINDOWS\system32\taskmgr.exe"
End If
End Sub

and in your form code the following -

Private Sub Form_Load()
DisTaskMngr True
End Sub

Private Sub Form_Unload(Cancel As Integer)
DisTaskMngr False
End Sub

If you want to "disable" other keypress events, maybe look at using code and ASCii to prevent certain events on taking place when user pressed the key for instance the 'TAB' key.

Attached is the ASCii list and control numbers that will be helpfull as well. You can use code as sample whilst say a textbox has focus -

If KeyAscii = 13 Then
    SendKeys "{tab}"
End If
Attachments asciifull.gif 27.35 KB extend.gif 11.13 KB

thanks guy... kill task manager huh..
that may solve the viewing of task manager... haha..
SendKeys may solve my problem.. i think..
Thanks Guys...
ill mark this thread as solve if it solve my problem..
il just try it out when im at home...

a little late... but another thing you could do would be make a regestry tweaker. you could tweak it so that those (or any) keys would be ineffective, and then just tweak it back. the keybord map is located at Hkey_local_Machine\system\currentcontrolset\control\keyboard layout
looking up something like keyboard maping would give you a nice chart to follow and better instruction, again sorry it was late!

Option Explicit
Public LastEvent As String
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Private Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal length As Long)
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long

Public Const HC_ACTION = 0
Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
Public Const WM_SYSKEYDOWN = &H104
Public Const WM_SYSKEYUP = &H105
Public Const VK_TAB = &H9
Public Const VK_CONTROL = &H11
Public Const VK_ESCAPE = &H1B
Public Const VK_STARTKEY = &H5B
Public Const VK_PAUSE = &H13

Public hhkLowLevelKybd As Long
Public hhkHookPause    As Long
Public hhkHookMouse     As Long
Public Const WH_KEYBOARD_LL = 13
Public Const WH_MOUSE = 7

Public Const LLKHF_ALTDOWN = &H20

Public Type KBDLLHOOKSTRUCT
    vkCode As Long
    scanCode As Long
    Flags As Long
    time As Long
    dwExtraInfo As Long
End Type

Public Type MOUSEHOOKSTRUCT
        pt As POINTAPI
        hwnd As Long
        wHitTestCode As Long
        dwExtraInfo As Long
End Type
Public Const WM_NCLBUTTONDOWN = &HA1
Public Const WM_NCRBUTTONDOWN = &HA4

Dim p As KBDLLHOOKSTRUCT


Public DisableHotKeyVar As Boolean

Public Const WM_RBUTTONDOWN = &H204
Public hHook As Long

Public Function MouseProc(ByVal nCode As Long, ByVal wParam As Long, _
                              ByVal lParam As Long) As Long
   If nCode >= 0 Then
      If nCode = HC_ACTION Then
         TimeElapsed = 0
         'StopReset = True
      End If
   End If
   MouseProc = CallNextHookEx(hHook, nCode, wParam, lParam)
End Function

Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
   Dim fEatKeystroke As Boolean
   
   If (nCode = HC_ACTION) Then
      TimeElapsed = 0
      StopReset = True
      LastEvent = "Keyboard " & nCode
      If wParam = WM_KEYDOWN Or wParam = WM_SYSKEYDOWN Or wParam = WM_KEYUP Or wParam = WM_SYSKEYUP Then
        CopyMemory p, ByVal lParam, Len(p)
         fEatKeystroke = _
            ((p.vkCode = VK_TAB) And ((p.Flags And LLKHF_ALTDOWN) <> 0)) Or _
            ((p.vkCode = VK_ESCAPE) And ((p.Flags And LLKHF_ALTDOWN) <> 0)) Or _
            ((p.vkCode = VK_ESCAPE) And ((GetKeyState(VK_CONTROL) And &H8000) <> 0)) Or _
            p.vkCode = VK_STARTKEY Or p.vkCode = 92 Or p.vkCode = 93
        End If
    End If
    
    If fEatKeystroke Then
        LowLevelKeyboardProc = -1
    Else
        LowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal lParam)
    End If

End Function


Public Sub DisableHotKeys(bDisabled As Boolean)
If Not BreakOn Then
    On Local Error Resume Next
Else
    If Not Test Then
        On Local Error GoTo ErrHandle
    End If
End If

Dim H As Long
Static DisableL As Boolean

If DisableL And bDisabled = True Then Exit Sub
DisableHotKeyVar = bDisabled
DisableL = True
H = FindWindow("Shell_traywnd", vbNullString)
If IsWindow(H) Then
    If bDisabled = True And IsWindowEnabled(H) Then
        EnableWindow H, 0
        ShowWindow H, 0
    ElseIf bDisabled = False And Not IsWindowEnabled(H) Then
        EnableWindow H, 1
        ShowWindow H, 5
    End If
End If

nReg.regCreate_A_Key HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System"
nReg.regCreate_A_Key HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum"
nReg.regCreate_A_Key HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"

If bDisabled Then
    hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)
    If CBool(nReg.GetProfileText("Setting", "WindowsPolicy", "True", App.Path & "\Config.ini")) Then
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoStartMenuMorePrograms", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "ClearRecentDocsOnExit", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "DisablePersonalDirChange", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "ForceClassicControlPanel", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "Intellimenus", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "LockTaskbar", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoAddPrinter", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDeletePrinter", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoAutoTrayNotify", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoAutoUpdate", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoClose", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoCloseDragDropBands", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoCommonGroups", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoControlPanel", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDesktop", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDesktopCleanupWizard", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoDriveTypeAutoRun", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoFavoritesMenu", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoFind", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoInstrumentation", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoInternetIcon", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoLogoff", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoMovingBands", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoNetHood", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoNetworkConnections", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoPropertiesMyComputer", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoPropertiesMyDocuments", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoPropertiesRecycleBin", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoRecentDocsHistory", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoRecentDocsMenu", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoRecentDocsNetHood", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoRun", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoSaveSettings", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoSetFolders", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoSetTaskbar", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoSMBalloonTip", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoSMConfigurePrograms", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoSMHelp", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoSMMyDocs", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoSMMyPictures", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoStartMenuEjectPC", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoStartMenuMFUprogramsList", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoStartMenuMorePrograms", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoStartMenuMyMusic", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoStartMenuNetworkPlaces", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoStartMenuPinnedList", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoStartMenuSubFolders", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoToolbarsOnTaskbar", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoTrayContextMenu", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoTrayItemsDisplay", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoUserNameInStartMenu", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoWindowsUpdate", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "StartMenuLogOff", 1
        
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum", "{450D8FBA-AD25-11D0-98A8-0800361B1103}", 1
        nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum", "{645FF040-5081-101B-9F08-00AA002F954E}", 1
    End If
    nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableChangePassword", 1
    nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableLockWorkstation", 1
    nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", 1
    
    
    
    
'---------- Internet
    nReg.regCreate_Key_Value HKEY_LOCAL_MACHINE, "SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings", "Security_options_edit", 1

    ChangeInternetZone nReg.GetProfileText("Setting", "InternetSecurity", "High", App.Path & "\Config.ini")
Else
    UnhookWindowsHookEx hhkLowLevelKybd
    hhkLowLevelKybd = 0
    
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoStartMenuMorePrograms", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "ClearRecentDocsOnExit", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "DisablePersonalDirChange", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "ForceClassicControlPanel", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "Intellimenus", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "LockTaskbar", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoAddPrinter", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoDeletePrinter", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoAutoTrayNotify", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoAutoUpdate", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoClose", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoCloseDragDropBands", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoCommonGroups", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoControlPanel", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoDesktop", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoDesktopCleanupWizard", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoDriveTypeAutoRun", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoFavoritesMenu", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoFind", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoInstrumentation", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoInternetIcon", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoLogoff", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoMovingBands", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoNetHood", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoNetworkConnections", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoPropertiesMyComputer", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoPropertiesMyDocuments", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoPropertiesRecycleBin", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoRecentDocsHistory", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoRecentDocsMenu", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoRecentDocsNetHood", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoRun", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoSaveSettings", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoSetFolders", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoSetTaskbar", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoSMBalloonTip", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoSMConfigurePrograms", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoSMHelp", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoSMMyDocs", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoSMMyPictures", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoStartMenuEjectPC", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoStartMenuMFUprogramsList", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoStartMenuMorePrograms", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoStartMenuMyMusic", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoStartMenuNetworkPlaces", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoStartMenuPinnedList", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoStartMenuSubFolders", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoToolbarsOnTaskbar", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoTrayContextMenu", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoTrayItemsDisplay", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoUserNameInStartMenu", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "NoWindowsUpdate", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "Explorer", "StartMenuLogOff", HKEY_CURRENT_USER, False
    
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "NonEnum", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "NonEnum", "{450D8FBA-AD25-11D0-98A8-0800361B1103}", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "NonEnum", "{645FF040-5081-101B-9F08-00AA002F954E}", HKEY_CURRENT_USER, False
    
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "System", "DisableChangePassword", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "System", "DisableLockWorkstation", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "System", "DisableTaskMgr", HKEY_CURRENT_USER, False
    
'---------- Internet
    nReg.regCreate_Key_Value HKEY_LOCAL_MACHINE, "SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings", "Security_options_edit", 0
    ChangeInternetZone nReg.GetProfileText("Setting", "InternetSecurityBack", "Medium", App.Path & "\Config.ini")
End If
'---------------------------
Exit Sub
ErrHandle:
frmAlert.Text = Err.Number & vbCrLf & Err.Description & vbCrLf & "Disable Hotkeys"
If Not frmAlert.Visible Then frmAlert.Show vbModal
On Local Error GoTo 0
End Sub

Private Sub ChangeInternetZone(Key As String)
Dim s As String
Dim S1 As String
Dim i As Long
i = 1
Do
    s = nReg.NGRead_Enum_Key(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Internet Settings\TemplatePolicies\" & Key, i)
    If s = "" Then Exit Do
    nReg.NGCopyItem HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Internet Settings\TemplatePolicies\" & Key, s, _
                    HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1\", s
    nReg.NGCopyItem HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Internet Settings\TemplatePolicies\" & Key, s, _
                    HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2\", s
    nReg.NGCopyItem HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Internet Settings\TemplatePolicies\" & Key, s, _
                    HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\", s
    nReg.NGCopyItem HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Internet Settings\TemplatePolicies\" & Key, s, _
                    HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4\", s
Loop
End Sub

Function PauseProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim fEatKeystroke As Boolean
If (nCode = HC_ACTION) Then
    TimeElapsed = 0
    StopReset = True
    If wParam = WM_KEYUP Then
        CopyMemory p, ByVal lParam, Len(p)
        If p.vkCode = VK_PAUSE Then
            PauseProc = -1
            Terminate
            Unload frmAlert
        Else
            PauseProc = CallNextHookEx(0, nCode, wParam, ByVal lParam)
        End If
    End If
End If
End Function

Public Sub HookPause()
hhkHookPause = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf PauseProc, App.hInstance, 0)
End Sub

Public Sub UnHookPause()
UnhookWindowsHookEx hhkHookPause
hhkHookPause = 0
End Sub

Public Sub HookMouse()
If hhkHookMouse <> 0 Then UnHookMouse
hhkHookMouse = SetWindowsHookEx(WH_MOUSE, AddressOf MouseProc, 0&, App.ThreadID)
End Sub

Public Sub UnHookMouse()
UnhookWindowsHookEx hhkHookMouse
hhkHookMouse = 0
End Sub

wow.. thats alot of code for disabling keys... hehe.. but how does it work?... i hope after i disable the keys i can enabled it again...

wops.. i found something...

i can use the BlockInput API right?... it will block the keyboard and mouse input, and i can also unblock it.. i wll just code it in the form event... thanks for all of your help...

nreg was a class to write in registry you can change it to your registry write function or install attachhment control
for create nreg write this code to first of module.
before do it must add in components its control from nastouh group

dim nreg as new ngregistry

this code copy paste from a program so you can change some line like
Public LastEvent As String
you can remove it and remove from all of the code.

you can use DisableHotKeys with parameter of True or False if you use True block every key lick win,ctrl+escape, alt+tab,... you see what key was hook on p.vkCode And p.Flags

Show window sub hide the task bar

and registry write disable or enable task manager+change password+ log off,...
and some change in policy like disbale or enable start menu run ,....
you see on the code

and some registry for internet control

function PauseProc check when u press pause key this function will be raised

to active use HookPause and to deactive use UnHookPause

you can hook mouse with HookMouse and unhook with UnHookMouse

i can clean up that code

Option Explicit
dim nreg as new ngregistry
Option Explicit
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Private Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal length As Long)
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long

Public Const HC_ACTION = 0
Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
Public Const WM_SYSKEYDOWN = &H104
Public Const WM_SYSKEYUP = &H105
Public Const VK_TAB = &H9
Public Const VK_CONTROL = &H11
Public Const VK_ESCAPE = &H1B
Public Const VK_STARTKEY = &H5B
Public Const VK_PAUSE = &H13

Public hhkLowLevelKybd As Long
Public Const WH_KEYBOARD_LL = 13
Public Const WH_MOUSE = 7

Public Const LLKHF_ALTDOWN = &H20

Public Type KBDLLHOOKSTRUCT
    vkCode As Long
    scanCode As Long
    Flags As Long
    time As Long
    dwExtraInfo As Long
End Type

Public Type MOUSEHOOKSTRUCT
        pt As POINTAPI
        hwnd As Long
        wHitTestCode As Long
        dwExtraInfo As Long
End Type
Public Const WM_NCLBUTTONDOWN = &HA1
Public Const WM_NCRBUTTONDOWN = &HA4

Dim p As KBDLLHOOKSTRUCT


Public DisableHotKeyVar As Boolean

Public Const WM_RBUTTONDOWN = &H204
Public hHook As Long

Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
   Dim fEatKeystroke As Boolean
   
   If (nCode = HC_ACTION) Then
      If wParam = WM_KEYDOWN Or wParam = WM_SYSKEYDOWN Or wParam = WM_KEYUP Or wParam = WM_SYSKEYUP Then
        CopyMemory p, ByVal lParam, Len(p)
         fEatKeystroke = _
            ((p.vkCode = VK_TAB) And ((p.Flags And LLKHF_ALTDOWN) <> 0)) Or _
            ((p.vkCode = VK_ESCAPE) And ((p.Flags And LLKHF_ALTDOWN) <> 0)) Or _
            ((p.vkCode = VK_ESCAPE) And ((GetKeyState(VK_CONTROL) And &H8000) <> 0)) Or _
            p.vkCode = VK_STARTKEY Or p.vkCode = 92 Or p.vkCode = 93
        End If
    End If
    
    If fEatKeystroke Then
        LowLevelKeyboardProc = -1
    Else
        LowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal lParam)
    End If

End Function


Public Sub DisableHotKeys(bDisabled As Boolean)
Dim H As Long
Static DisableL As Boolean

If DisableL And bDisabled = True Then Exit Sub
DisableHotKeyVar = bDisabled
DisableL = True
H = FindWindow("Shell_traywnd", vbNullString)
If IsWindow(H) Then
    If bDisabled = True And IsWindowEnabled(H) Then
        EnableWindow H, 0
        ShowWindow H, 0
    ElseIf bDisabled = False And Not IsWindowEnabled(H) Then
        EnableWindow H, 1
        ShowWindow H, 5
    End If
End If

nReg.regCreate_A_Key HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System"
nReg.regCreate_A_Key HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum"
nReg.regCreate_A_Key HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"

If bDisabled Then
    hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)
    nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableChangePassword", 1
    nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableLockWorkstation", 1
    nReg.regCreate_Key_Value HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", 1
Else
    UnhookWindowsHookEx hhkLowLevelKybd
    hhkLowLevelKybd = 0
    
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "System", "DisableChangePassword", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "System", "DisableLockWorkstation", HKEY_CURRENT_USER, False
    nReg.NGDeleteRegistry "Software\Microsoft\Windows\CurrentVersion\Policies\", "System", "DisableTaskMgr", HKEY_CURRENT_USER, False
End If
'---------------------------
Exit Sub
ErrHandle:
frmAlert.Text = Err.Number & vbCrLf & Err.Description & vbCrLf & "Disable Hotkeys"
If Not frmAlert.Visible Then frmAlert.Show vbModal
On Local Error GoTo 0
End Sub
This question has already been answered. Start a new discussion instead.