Block CTRL+ALT+DEL and ALT+TAB key combinations
By: Lorenzo Dalla Vecchia  Date: 21/10/2001

Note: because of security features of the OS, this may not work with Windows NT or 2000.

This tip describes how to enable/disable the key combinations CTRL+ALT+DEL (used to bring up the task list and eventually to reboot the system) and ALT+TAB (used to zap between open applications).

Cut and past the following API declarations and procedure definition:

Public Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, _

ByVal uParam As Long, lpvParam As Any, _
ByVal fuWinIni As Long) As Long
Private Const SPI_SCREENSAVERRUNNING = 97

Public Sub EnableKeys(Switch As Boolean)
    If Switch = False Then
        SystemParametersInfo SPI_SCREENSAVERRUNNING, 1&, 0&, 0
    Else
        SystemParametersInfo SPI_SCREENSAVERRUNNING, 0&, 0&, 0
    End If
End Sub

Now, when you want to disable the keys, use Call EnableKeys(False), and use Call EnableKeys(True) when you want to enable them again.

Click Here!


Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: www.inwind.it