We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 54,314 times

Related Categories

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

James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.

Comments

  • Re: [152] Disable Ctrl+Alt+Del

    Posted by slimetoner on 14 Sep 2007

    Win Padlock

    In 1 or 3 lines of code... you can do any of these:

    -Disable CTRL+ALT+DEL, CTRL+ESC, WINLOGO...

  • Re: [152] Disable Ctrl+Alt+Del

    Posted by ctjpn on 04 Apr 2007

    Hi!


    This code for disabling the Ctrl+Alt+Delete functionality is not running on Windows XP.


    Could you suggest something for Windows XP?


     


    Thanks.

  • Awesome...

    Posted by mrjdesign on 01 Mar 2004

    Thanks for the tip...

    Is there a similar way to disable the START button too???

    In Specific... the CTRL+C and Windows APP key ( vKeyCode = 91)

  • Posted by AST867 on 28 Feb 2004

    There is a system registery key that controls the task manager. If you set its value to 1, the task manager is disabled!The code for that would be:

    Dim Path As String

    Path = "Software\Mi...

  • Possible problem

    Posted by HyperHacker on 11 Feb 2004

    I just thought of this a while ago. This works by making the OS think a screen saver is running... So what happens if the user manually runs one and closes it? The OS will re-enable the keys!