HOWTO: Block CTRL+ALT+DEL and ALT+TAB in Windows 95ID: Q161133
|
You can prevent the CTRL+ALT+DEL and ALT+TAB key combinations from bringing
up a task list in Windows 95 by calling the SystemParametersInfo function
in the Win32 API. A step-by-step example of this appears below.
NOTE: This is possible only in Windows 95.
Sometimes it is necessary for a program to prevent the use of the
CTRL+ALT+DEL key combination to bring up the Close Program task list to end
a task or shut down Windows 95 and to prevent the use of the ALT+TAB key
combination to switch tasks. The following technique uses the
SystemParametersInfo API to trick Windows 95 into thinking that a screen
saver is running. As a side effect, CTRL+ALT+DEL and ALT+TAB are disabled.
The Win32 SDK states:
"SPI_SCREENSAVERRUNNING Windows 95: Used internally; applications should not use this flag. Windows NT: Not supported."
Private Const SPI_SCREENSAVERRUNNING = 97&
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 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
Private Sub Command1_Click()
Dim lngRet As Long
Dim blnOld As Boolean
lngRet = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, _
blnOld, _
0&)
End Sub
Private Sub Command2_Click()
Dim lngRet As Long
Dim blnOld As Boolean
lngRet = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, _
blnOld, _
0&)
End Sub
Additional query words:
kbVBp400 kbVBp500 kbVBp600 kbVBp kbdsd kbDSupport reboot SetSysModalWindow
KBWIN32SDK KBAPI
Keywords :
Version :
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: June 7, 1999