'声明 Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Const SW_HIDE = 0 Private Const SW_SHOW = 5 Private Const SW_SHOWNORMAL = 1'屏蔽开始按钮 Dim hLong As Long Dim hWnd As Long hWnd = FindWindow("Shell_TrayWnd", vbNullString) hLong = FindWindowEx(hWnd, 0, "Button", vbNullString) ShowWindow hLong, SW_HIDE
'显示开始按钮 Dim hLong As Long Dim hWnd As Long hWnd = FindWindow("Shell_TrayWnd", vbNullString) hLong = FindWindowEx(hWnd, 0, "Button", vbNullString) ShowWindow hLong, SW_SHOW
那样还是屏蔽不了ctrl+esc,windows键ShowWindow hLong, SW_SHOW 改为 EnableWindow hLong, 0再用Private Declare Function SystemParametersInfo Lib "user32" _ Alias "SystemParametersInfoA" (ByVal uAction As Long, _ ByVal uParam As Long, lpvParam As Any, _ ByVal fuWinIni As Long) As LongPrivate Const SPI_SCREENSAVERRUNNING = 97 Private Sub Command1_Click() Dim ret As Integer Dim pOld As Boolean
If Command1.Caption = "屏蔽" Then '使Ctrl+Alt+Del有效 ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0) Command1.Caption = "有效" Else '使Ctrl+Alt+Del无效 ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0) Command1.Caption = "屏蔽" End If End SubPrivate Sub Form_Load() Command1.Caption = "屏蔽" End SubPrivate Sub Form_Unload(Cancel As Integer) Dim ret As Integer Dim pOld As Boolean
'退出前使ALT+CTL+DEL有效 ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0) End Sub虽然在2k下不能屏蔽ctrl+alt+del,但是屏蔽ctrl+esc还是可以的。
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const SW_HIDE = 0
Private Const SW_SHOW = 5
Private Const SW_SHOWNORMAL = 1'屏蔽开始按钮
Dim hLong As Long
Dim hWnd As Long
hWnd = FindWindow("Shell_TrayWnd", vbNullString)
hLong = FindWindowEx(hWnd, 0, "Button", vbNullString)
ShowWindow hLong, SW_HIDE
Dim hLong As Long
Dim hWnd As Long
hWnd = FindWindow("Shell_TrayWnd", vbNullString)
hLong = FindWindowEx(hWnd, 0, "Button", vbNullString)
ShowWindow hLong, SW_SHOW
改为
EnableWindow hLong, 0再用Private Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As Any, _
ByVal fuWinIni As Long) As LongPrivate Const SPI_SCREENSAVERRUNNING = 97
Private Sub Command1_Click()
Dim ret As Integer
Dim pOld As Boolean
If Command1.Caption = "屏蔽" Then '使Ctrl+Alt+Del有效
ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0)
Command1.Caption = "有效"
Else '使Ctrl+Alt+Del无效
ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
Command1.Caption = "屏蔽"
End If
End SubPrivate Sub Form_Load()
Command1.Caption = "屏蔽"
End SubPrivate Sub Form_Unload(Cancel As Integer)
Dim ret As Integer
Dim pOld As Boolean
'退出前使ALT+CTL+DEL有效
ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
End Sub虽然在2k下不能屏蔽ctrl+alt+del,但是屏蔽ctrl+esc还是可以的。