I can enable or disable task manager manually. like: start> run > gpedit.msc
from group policy setting > user configuration > administrative templetes> system>
ctrl+alt+del. I want to do it in vb6. If click a button then it disable or enable. Is it
possible to do? If yes then how?

Just remember that Sendkeys will NOT work in Vista or Win7.

I took the entire long route which works wonders. If someone knows what they are doing, they can still use task manager....

This will disable it until the application is closed.

Public Declare Function SystemParametersInfo Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long



x = SystemParametersInfo(97, 1, CStr(1), 0) 'Disable Ctrl+Alt+Del Keys combination
'Use as in --->>>
If KeyAscii >= vbKeyA And KeyAscii <= vbKeyZ Or KeyAscii >= 97 And KeyAscii <= 122 Or KeyAscii >= vbKey0 And KeyAscii <= vbKey9 Or KeyAscii = vbKeyBack Then
        'do nothing
    Else
        KeyAscii = 0    'Disable all other key strokes
    End If

Edited 5 Years Ago by AndreRet: n/a

Just remember that Sendkeys will NOT work in Vista or Win7.

I took the entire long route which works wonders. If someone knows what they are doing, they can still use task manager....

This will disable it until the application is closed.

Public Declare Function SystemParametersInfo Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long



x = SystemParametersInfo(97, 1, CStr(1), 0) 'Disable Ctrl+Alt+Del Keys combination
'Use as in --->>>
If KeyAscii >= vbKeyA And KeyAscii <= vbKeyZ Or KeyAscii >= 97 And KeyAscii <= 122 Or KeyAscii >= vbKey0 And KeyAscii <= vbKey9 Or KeyAscii = vbKeyBack Then
        'do nothing
    Else
        KeyAscii = 0    'Disable all other key strokes
    End If

Will that code work on windows vista and windows 7? It can also disable other keys like ALT-Tab or ALT-ESC ?

Yes, it will disable all as per the ascii character set specified. If you want to disable more keys, just add them to the ascii set.

This article has been dead for over six months. Start a new discussion instead.