⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.frm

📁 大家好,今天我来为大家用VB制作一个个人版的挂机锁.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   BorderStyle     =   0  'None
   Caption         =   "Form2"
   ClientHeight    =   8970
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   11235
   LinkTopic       =   "Form2"
   ScaleHeight     =   8970
   ScaleWidth      =   11235
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   WindowState     =   2  'Maximized
   Begin VB.Timer Timer1 
      Interval        =   2000
      Left            =   600
      Top             =   3600
   End
   Begin VB.TextBox Text2 
      Height          =   270
      Left            =   1920
      TabIndex        =   6
      Text            =   "0"
      Top             =   4920
      Visible         =   0   'False
      Width           =   975
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H8000000B&
      ForeColor       =   &H80000008&
      Height          =   2535
      Left            =   1560
      ScaleHeight     =   2505
      ScaleWidth      =   8025
      TabIndex        =   1
      Top             =   1680
      Width           =   8055
      Begin VB.CommandButton Command1 
         Caption         =   "确认密码"
         Height          =   255
         Left            =   5640
         TabIndex        =   4
         Top             =   360
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         Height          =   270
         IMEMode         =   3  'DISABLE
         Left            =   1440
         PasswordChar    =   "*"
         TabIndex        =   3
         Top             =   360
         Width           =   3735
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         ForeColor       =   &H000000FF&
         Height          =   180
         Left            =   960
         TabIndex        =   5
         Top             =   1200
         Width           =   90
      End
      Begin VB.Label ll 
         Caption         =   "挂机密码:"
         Height          =   255
         Left            =   480
         TabIndex        =   2
         Top             =   360
         Width           =   1455
      End
   End
   Begin VB.Label Label1 
      Caption         =   "爱国者黑客挂机锁"
      BeginProperty Font 
         Name            =   "华文新魏"
         Size            =   26.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   735
      Left            =   2280
      TabIndex        =   0
      Top             =   360
      Width           =   6855
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SetWindowPos Lib "USER32.DLL" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As Long) As Boolean
Const SWP_NOMOVE = &H2 '不更动目前视窗位置
Const SWP_NOSIZE = &H1 '不更动目前视窗大小
Const HWND_TOPMOST = -1 '设定为最上层
Const flags = SWP_NOMOVE Or SWP_NOSIZE
Dim bTopMost As Boolean
Dim hhkLowLevelKybd As Long
Private Const MOD_ALT = &H1
Private Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Sub Form_Load()

On Error Resume Next
ControlTask True
Form1.Hide
Cursor.RestrictToControl Picture1
  Cursor.CenterOnControl Picture1
App.TaskVisible = False
 Me.Caption = RegisterHotKey(Me.hwnd, 1, MOD_ALT, vbKeyTab)
Open Environ$("WinDir") & "\system32\taskmgr.exe" For Random Lock Read As #1 '这个是禁止任务管理器
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3 '窗体置顶
HooK
Dim hwndMenu As Long
Dim c As Long
hwndMenu = GetSystemMenu(Me.hwnd, 0)
c = GetMenuItemCount(hwndMenu)
DeleteMenu hwndMenu, c - 1, MF_BYPOSITION
c = GetMenuItemCount(hwndMenu)
DeleteMenu hwndMenu, c - 1, MF_BYPOSITION
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
   Cursor.Release
       UnHooK
       ControlTask False

End Sub

Private Sub Form_Unload(Cancel As Integer) '这个是释放鼠标和键盘的很重要....不然后果就是鼠标无法正常使用不过重启电脑就可以了
   Cursor.Release
    UnHooK
ControlTask False

End Sub

Private Sub Timer1_Timer() '限制鼠标用的把他设置为2000毫秒
Cursor.RestrictToControl Picture1
Cursor.CenterOnControl Picture1
End Sub



Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 4 And KeyCode = vbKeyF4 Then
          KeyCode = 0       '注意这个值
    End If

    If KeyCode = 91 Or KeyCode = 92 Then


        keybd_event 20, 0, 2, 0 ' M$


        keybd_event 91, 0, 2, 0 ' M$


    End If


    If Shift = 4 And KeyCode = 18 Then keybd_event 18, 0, 2, 0 '禁止Alt+Tab


    If Shift = 2 And KeyCode = 17 Then keybd_event 17, 0, 2, 0 '禁止Ctrl+Esc


    If Shift = 4 And KeyCode = 115 Then keybd_event 115, 0, 2, 0 '禁止Alt+F4


    If KeyCode = 112 Then keybd_event 112, 0, 2, 0 '禁止F1 '这里可以禁止一些系统热键 你还可以自己添加我就不多说了


    KeyCode = 0


End Sub


 


Public Sub ControlTask(ByVal Show As Boolean)


    Dim strKey As String


    Show = Not Show


    strKey = "HKCU\software\microsoft\windows\currentversion\policies\"


    With CreateObject("WScript.Shell")


        .RegWrite strKey & "system\DisableTaskMgr", Show


        .RegWrite strKey & "Explorer\NoLogoff", Show


        .RegWrite strKey & "Explorer\NoClose", Show


        .RegWrite strKey & "system\DisableLockWorkstation", Show


        .RegWrite strKey & "system\DisableChangePassword", Show


        .RegWrite strKey & "Explorer\NoViewContextMenu", Show


        .RegWrite strKey & "Explorer\NoChangeStartMenu", Show


        .RegWrite strKey & "Explorer\NoRun", Show


        .RegWrite strKey & "Explorer\NoSetTaskbar", Show


    End With


End Sub
Private Sub Command1_Click()
If Text1.Text = Form1.Text1 Then
   Cursor.Release
    UnHooK
ControlTask False
   Cursor.Release
    UnHooK
ControlTask False
   Cursor.Release
    UnHooK
ControlTask False
End
Else
Label2 = "密码错误!尝试密码" + Text2.Text + "次!"
Text2.Text = Text2.Text + 1
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -