📄 listkillform.frm
字号:
VERSION 5.00
Object = "{82EDD048-7E49-11D2-8D41-444553540000}#1.0#0"; "LISTKILLPROCESS.OCX"
Begin VB.Form ListKillForm
Caption = "ListKillProcess ActiveX Control Demo"
ClientHeight = 5205
ClientLeft = 60
ClientTop = 375
ClientWidth = 6690
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 5205
ScaleWidth = 6690
StartUpPosition = 3 'Windows Default
Begin ListAndKillProcess.ListKillProcess ListKillProcess1
Left = 1680
Top = 5280
_ExtentX = 1085
_ExtentY = 1085
End
Begin VB.TextBox ProcessInfo
Height = 855
Left = 120
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 4
Text = "ListKillForm.frx":0000
Top = 3120
Width = 6495
End
Begin VB.Timer Timer1
Interval = 100
Left = 480
Top = 5160
End
Begin VB.CommandButton RefreshCommand
Caption = "Refresh Process List"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 1
Top = 4320
Width = 6495
End
Begin VB.ListBox ProcessList
BackColor = &H00000000&
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00E0E0E0&
Height = 2355
ItemData = "ListKillForm.frx":000F
Left = 120
List = "ListKillForm.frx":0011
Style = 1 'Checkbox
TabIndex = 0
Top = 480
Width = 6495
End
Begin VB.Line Line4
BorderColor = &H00E0E0E0&
X1 = 0
X2 = 6720
Y1 = 3000
Y2 = 3000
End
Begin VB.Line Line3
X1 = 0
X2 = 6720
Y1 = 2880
Y2 = 2880
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "Try to activate Notepad or another process"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = -120
TabIndex = 3
Top = 4800
Width = 6855
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "Check the small box to kill a process"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 2
Top = 0
Width = 6495
End
Begin VB.Line Line2
BorderColor = &H00E0E0E0&
X1 = 0
X2 = 6720
Y1 = 4200
Y2 = 4200
End
Begin VB.Line Line1
X1 = 0
X2 = 6720
Y1 = 4080
Y2 = 4080
End
End
Attribute VB_Name = "ListKillForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim MaxNumberOfProcesses As Integer
Private Sub Form_Load()
ListKillProcess1.List_Processes = True
ProcessList.Clear
For i = 1 To ListKillProcess1.Number_Of_Processes
ListKillProcess1.Get_Process_Info = i
ProcessList.AddItem Str(i) + " " + ListKillProcess1.Process_Name
Next i
MaxNumberOfProcesses = ListKillProcess1.Number_Of_Processes
End Sub
Private Sub ProcessList_ItemCheck(Item As Integer)
ListKillProcess1.Get_Process_Info = Item + 1
Response = MsgBox(ListKillProcess1.Process_Name, vbOKCancel, "Click OK to kill process or CANCEL to see process info")
If Response = vbOK Then
ListKillProcess1.ID_To_Kill = ListKillProcess1.Process_ID
ListKillProcess1.Kill_Process = True
ListKillProcess1.List_Processes = True
ProcessList.Clear
For i = 1 To ListKillProcess1.Number_Of_Processes
ListKillProcess1.Get_Process_Info = i
ProcessList.AddItem Str(i) + " " + ListKillProcess1.Process_Name
Next i
Else
ProcessInfo.Text = _
"Number of Threads = " + Str(ListKillProcess1.Number_Of_Threads) + vbCrLf + _
"Parent Process ID = " + Hex(ListKillProcess1.Parent_Process_ID) + vbCrLf + _
"Module ID= " + Hex(ListKillProcess1.Module_ID) + vbCrLf + _
"Process ID = " + Hex(ListKillProcess1.Process_ID) + vbCrLf + _
"Priority Base = " + Str(ListKillProcess1.Priority_Base) + vbCrLf + _
"Usage = " + Str(ListKillProcess1.Usage)
End If
End Sub
Private Sub RefreshCommand_Click()
ListKillProcess1.List_Processes = True
ProcessList.Clear
For i = 1 To ListKillProcess1.Number_Of_Processes
ListKillProcess1.Get_Process_Info = i
ProcessList.AddItem Str(i) + " " + ListKillProcess1.Process_Name
Next i
MaxNumberOfProcesses = ListKillProcess1.Number_Of_Processes
End Sub
Private Sub Timer1_Timer()
DoEvents
ListKillProcess1.List_Processes = True
If ListKillProcess1.Number_Of_Processes > MaxNumberOfProcesses Then
ListKillProcess1.Get_Process_Info = MaxNumberOfProcesses + 1
ListKillProcess1.ID_To_Kill = ListKillProcess1.Process_ID
ListKillProcess1.Kill_Process = True
'MsgBox ListKillProcess1.Process_Name
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -