📄
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "系统监视器"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
Icon = "系统监视器.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.Timer Timer1
Interval = 60000
Left = 600
Top = 1800
End
Begin VB.CommandButton Command2
Caption = "程序结束"
Height = 495
Left = 1560
TabIndex = 1
Top = 1680
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "开始监视"
Height = 495
Left = 1560
TabIndex = 0
Top = 840
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'本程序每隔 2 分钟"检查"一下窗口。如果运行的是"扫雷"、"红心大战"等游戏,就强行关闭它,并发出警告。
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const WM_CLOSE = &H10
Const WM_QUIT = &H12
Dim Handle As Integer
Dim n As Integer
Private Sub Command1_Click()
Timer1.Enabled = True '激活时间控件,运行第 5 步的操作
Form1.Hide
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Timer1.Interval = 60000
Timer1.Enabled = False '使时间控件失效
End Sub
Private Sub Timer1_Timer()
n = n + 1
If n = 1 Then CloseWin '这里设置为每隔2分钟运行一次
End Sub
Sub CloseWin() '关闭指定窗口
Dim WinText(1 To 3) As String
Dim i As Integer
WinText(1) = "扫雷" '关闭下面的3个游戏,各位可以自己定义,不过程序窗口的标题一定要对,不然程序是不会被关闭的。
WinText(2) = "Microsoft 网上红心大战"
WinText(3) = "纸牌"
For i = 1 To 3
Handle = FindWindow(vbNullString, WinText(i))
PostMessage Handle, WM_CLOSE, 0, 0
Next
If Handle <> 0 Then MsgBox "呵呵,小子你又在偷玩游戏" '如果在玩上面的3个游戏,则关闭游戏,并警告
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -