主题:[原创]锁定屏幕原代码发布
Dim m_Exit As Boolean '限制ALT+F4退出窗体
'******隐藏任务栏代码************************************
'参数;lpClassName 指定了包含了窗口类名中的空中止,字串的指针,或设为0。表示接收任何类。
'参数;lpWindowName 指向包含了窗口文本的空中止,字串的指针。或设为0。表示接收任何窗口标题。
'功能;寻找窗口列表中第一个符合指定条件的顶级窗口。
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Dim X As Long
Dim StartWindow As Long
Dim ClassName As String
'******隐藏任务栏代码************************************
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If m_Exit = True Then
DelHook '销内存
End
Else
If m_Exit = False Then
Cancel = -1
End If
End If
End Sub
Private Sub Form_Load()
If App.PrevInstance Then
MsgBox "本系统已在运行中, 不得重复加载!!", vbOKOnly + 16, "提示信息"
End
End If
Frame1.Move Screen.Width / 3, Screen.Height / 5
m_Exit = False
'最大化,最小化,关闭按钮不可用
ModSuPing.MFREMOVE (Me.hwnd)
'********************************8
ClassName = Space(256)
ClassName = "Shell_TrayWnd"
StartWindow = FindWindow(ClassName, vbNullString)
'隐藏任务栏
X = ShowWindow(StartWindow, SW_HIDE)
' MsgBox "任务栏被隐藏"
'下面语句可以屏蔽任务管理器
On Error Resume Next
Dim s As String
s = Environ("windir")
s = s + "\system32\taskmgr.exe"
Open s For Random Lock Read As #1
Call AddHook '屏蔽Win键
End Sub
Private Sub Form_Activate()
'调用函数。限制鼠标。
ModSuPing.ShuPing Frame1
'********************************8
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 And Len(Text1.Text) = 18 Then
If Text1.Text = "123456789987654321" Then
Text1.Text = ""
'显示任务栏
X = ShowWindow(StartWindow, SW_SHOWNORMAL)
' MsgBox "任务栏恢复"
'********************************8
'调用函数。。解限制鼠标。
ModSuPing.JieShu Frame1
'********************************8
m_Exit = True
Call Form_QueryUnload(1, 1)
End If
End If
End Sub
'====================下边代码屏蔽win按键
Private Sub AddHook()
lHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)
End Sub
Private Sub DelHook()
UnhookWindowsHookEx lHook
End Sub
'******隐藏任务栏代码************************************
'参数;lpClassName 指定了包含了窗口类名中的空中止,字串的指针,或设为0。表示接收任何类。
'参数;lpWindowName 指向包含了窗口文本的空中止,字串的指针。或设为0。表示接收任何窗口标题。
'功能;寻找窗口列表中第一个符合指定条件的顶级窗口。
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Dim X As Long
Dim StartWindow As Long
Dim ClassName As String
'******隐藏任务栏代码************************************
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If m_Exit = True Then
DelHook '销内存
End
Else
If m_Exit = False Then
Cancel = -1
End If
End If
End Sub
Private Sub Form_Load()
If App.PrevInstance Then
MsgBox "本系统已在运行中, 不得重复加载!!", vbOKOnly + 16, "提示信息"
End
End If
Frame1.Move Screen.Width / 3, Screen.Height / 5
m_Exit = False
'最大化,最小化,关闭按钮不可用
ModSuPing.MFREMOVE (Me.hwnd)
'********************************8
ClassName = Space(256)
ClassName = "Shell_TrayWnd"
StartWindow = FindWindow(ClassName, vbNullString)
'隐藏任务栏
X = ShowWindow(StartWindow, SW_HIDE)
' MsgBox "任务栏被隐藏"
'下面语句可以屏蔽任务管理器
On Error Resume Next
Dim s As String
s = Environ("windir")
s = s + "\system32\taskmgr.exe"
Open s For Random Lock Read As #1
Call AddHook '屏蔽Win键
End Sub
Private Sub Form_Activate()
'调用函数。限制鼠标。
ModSuPing.ShuPing Frame1
'********************************8
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 And Len(Text1.Text) = 18 Then
If Text1.Text = "123456789987654321" Then
Text1.Text = ""
'显示任务栏
X = ShowWindow(StartWindow, SW_SHOWNORMAL)
' MsgBox "任务栏恢复"
'********************************8
'调用函数。。解限制鼠标。
ModSuPing.JieShu Frame1
'********************************8
m_Exit = True
Call Form_QueryUnload(1, 1)
End If
End If
End Sub
'====================下边代码屏蔽win按键
Private Sub AddHook()
lHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)
End Sub
Private Sub DelHook()
UnhookWindowsHookEx lHook
End Sub