禁用Ctrl-Alt-Del
Private Declare Function EnableWindow Lib "user32" (ByVal hWnd As
Integer, ByVal aBOOL As Integer) As Integer
Private Declare Function IsWindowEnabled Lib "user32" (ByVal hWnd As
Integer) As Integer
Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Integer) As
Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (
ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SystemParametersInfo Lib "user32" Alias "
SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long,
ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
Private TaskBarhWnd As Long
Private IsTaskBarEnabled As Integer
Private TaskBarMenuHwnd As Integer
'禁止使用Ctrl-Alt-Del
Public Sub DisableTaskBar()
Dim EWindow As Integer
TaskBarhWnd = FindWindow("Shell_traywnd", "")
If TaskBarhWnd <> 0 Then
EWindow = IsWindowEnabled(TaskBarhWnd)
If EWindow = 1 Then
IsTaskBarEnabled = EnableWindow(TaskBarhWnd, 0)
End If
End If
End Sub
'允许使用Ctrl-Alt-Del
Public Sub EnableTaskBar()
If IsTaskBarEnabled = 0 Then
IsTaskBarEnabled = EnableWindow(TaskBarhWnd, 1)
End If
End Sub
'禁止 Ctrl+Alt+Del
' 声明(For Win95):
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
使用:
'禁止
Dim pOld As Boolean
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0)
'开启
Dim pOld As Boolean
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
Private Declare Function EnableWindow Lib "user32" (ByVal hWnd As
Integer, ByVal aBOOL As Integer) As Integer
Private Declare Function IsWindowEnabled Lib "user32" (ByVal hWnd As
Integer) As Integer
Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Integer) As
Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (
ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SystemParametersInfo Lib "user32" Alias "
SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long,
ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
Private TaskBarhWnd As Long
Private IsTaskBarEnabled As Integer
Private TaskBarMenuHwnd As Integer
'禁止使用Ctrl-Alt-Del
Public Sub DisableTaskBar()
Dim EWindow As Integer
TaskBarhWnd = FindWindow("Shell_traywnd", "")
If TaskBarhWnd <> 0 Then
EWindow = IsWindowEnabled(TaskBarhWnd)
If EWindow = 1 Then
IsTaskBarEnabled = EnableWindow(TaskBarhWnd, 0)
End If
End If
End Sub
'允许使用Ctrl-Alt-Del
Public Sub EnableTaskBar()
If IsTaskBarEnabled = 0 Then
IsTaskBarEnabled = EnableWindow(TaskBarhWnd, 1)
End If
End Sub
'禁止 Ctrl+Alt+Del
' 声明(For Win95):
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
使用:
'禁止
Dim pOld As Boolean
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0)
'开启
Dim pOld As Boolean
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
解决方案 »
- 在VB中如何加背景图片!
- 请教如何将UTC格式的时间转成常见的标准的北京时间
- 求教:一个数据更新的问题
- 内网的客户端使用TCP协议,是否可以直接和外网的计算机(有固定IP的服务器)进行连接,不设置代理服务器。
- 剩下的全部70相送,求API函数,关于怎么样关闭某个进程或者正在运行的程序。
- 颜色填充(十万火急!!!!)
- 用DataGrid时,提示"The current row is not available",请帮忙解决,谢谢!
- 一个关于TextBox显示的问题.........
- 释放内存?
- 谁 能 送 我 点 可 用 分 ?我 的 问 题 都 是 在 这 里 解 决 的 .但 总 觉 得 可 用 分 不 够
- to 小草:拨号代码
- VISUAL STUDIO.NET终于到了
"user32" Alias "SystemParametersInfoA" (ByVal uAction _
As Long, ByVal uParam As Long, ByVal lpvParam As Any, _
ByVal fuWinIni As Long) As Long
自定义函数在Form_Load事件中调用即可
Sub DisableCtrlAltDelete(Flags As Boolean)
' Disables Control Alt Delete Breaking as well as Ctrl-Escape
Dim X As Long
X = SystemParametersInfo(97, Flags, CStr(1), 0)
End Sub