Disable Ctrl+Alt+Del

This example tricks Windows 95 and Windows 98 into thinking that a screen saver is running - which also disables Ctrl+Alt+Delete and Alt+Tab. Note that this does NOT work on Windows NT!

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

Private Sub Command1_Click()
  Dim ret As Integer
     Dim pOld As Boolean
     ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0)
End Sub

Private Sub Command2_Click()
Dim ret As Integer
     Dim pOld As Boolean
     ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
End Sub

Private Sub Form_Load()
Command1.Caption = "Disabled"
     Command2.Caption = "Enabled"
End Sub

Private Sub Form_Unload(Cancel As Integer)
'  re-enable Ctrl+Alt+Del and Alt+Tab before the program terminates
     Command2_Click
End Sub

You might also like...

Comments

James Crowley James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audience ...

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Beware of bugs in the above code; I have only proved it correct, not tried it.” - Donald Knuth