Disable the effect of Ctrl+Alt+Del and Alt+Tab

By | 2002-06-01

Disables the effect of Ctrl+Alt+Del and Alt-Tab. It can be used for security programs or just so the user cant exit your program or restart the computer from the keyboard.

Original Author: Steve Berardi

Assumptions

This code accomplishes it’s task by telling Windows that a screen saver is running, therefor, ctrl+alt+del wont work.

Side Effects

Note that this code disables the use of restarting your computer by hitting ctrl+alt+del. The only way the user will be able to restart the computer would be to turn it off then back on. I also included the code to enable ctrl+alt+del again.

API Declarations

Private 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

Code

Sub Enable_TaskView()
Dim eTask As Integer
Dim junk As Boolean

eTask = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, junk, 0)
End Sub
Sub Disable_TaskView()
Dim dTask As Integer
Dim junk As Boolean

dTask = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, junk, 0)
End Sub

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.