vb程序运行时禁用任务管理器
怎样能让vb程序运行时禁用任务管理器,并且不影响鼠标键盘的使用?在网上找到了这段程序,虽然能禁用任务管理器,但是打开程序窗口后鼠标一直在不停的点击,无法在软件界面上输入文...
怎样能让vb程序运行时禁用任务管理器,并且不影响鼠标键盘的使用?在网上找到了这段程序,虽然能禁用任务管理器,但是打开程序窗口后鼠标一直在不停的点击,无法在软件界面上输入文字,请高手指点一下该怎么改?
-----------------------------------------------------------------------------------------------------
先添一个Timer,Interval属性可以设成10
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Timer1_Timer()
dim hw
hw = FindWindow(vbNullString, "Windows 任务管理器")
SendMessage hw, &H10, 0, 0
SendKeys "%"
Me.SetFocus
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = Asc("I") Then End
End Sub
'一按“I”键就可以退出来了。
将 CTRL + ALT + DEL 功能键之功能取消,然后在结束程序之前,再从新恢复 CTRL + ALT + DEL 之功能
在模组声明区中加入以下声明及模组:
Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Public Const SPI_SCREENSAVERRUNNING = 97
Public Sub Disable_Ctrl_Alt_Del()
’让 CTRL+ALT+DEL 失效
Dim AyW As Integer
Dim TurFls As Boolean
AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, TurFls, 0)
End Sub
Public Sub Enable_Ctrl_Alt_Del()
’让 CTRL+ALT+DEL 恢复功能
Dim AwY As Integer
Dim TurFls As Boolean
AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, TurFls, 0)
End Sub
’实际使用时,在 Form 中加入以下程序码:
Private Sub Form_Load()
Disable_Ctrl_Alt_Del
End Sub
Private Sub Form_Unload(Cancel As Integer)
Enable_Ctrl_Alt_Del
End Sub 展开
-----------------------------------------------------------------------------------------------------
先添一个Timer,Interval属性可以设成10
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Timer1_Timer()
dim hw
hw = FindWindow(vbNullString, "Windows 任务管理器")
SendMessage hw, &H10, 0, 0
SendKeys "%"
Me.SetFocus
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = Asc("I") Then End
End Sub
'一按“I”键就可以退出来了。
将 CTRL + ALT + DEL 功能键之功能取消,然后在结束程序之前,再从新恢复 CTRL + ALT + DEL 之功能
在模组声明区中加入以下声明及模组:
Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Public Const SPI_SCREENSAVERRUNNING = 97
Public Sub Disable_Ctrl_Alt_Del()
’让 CTRL+ALT+DEL 失效
Dim AyW As Integer
Dim TurFls As Boolean
AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, TurFls, 0)
End Sub
Public Sub Enable_Ctrl_Alt_Del()
’让 CTRL+ALT+DEL 恢复功能
Dim AwY As Integer
Dim TurFls As Boolean
AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, TurFls, 0)
End Sub
’实际使用时,在 Form 中加入以下程序码:
Private Sub Form_Load()
Disable_Ctrl_Alt_Del
End Sub
Private Sub Form_Unload(Cancel As Integer)
Enable_Ctrl_Alt_Del
End Sub 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询