可以用来控制一些需要隐藏运行的程序,支持手动终结。

VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "通用执行器"
ClientHeight = 6720
ClientLeft = 45
ClientTop = 390
ClientWidth = 9630
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6720
ScaleWidth = 9630
StartUpPosition = 2 '屏幕中心
Begin VB.CheckBox Check1
Caption = "显示运行窗体"
Height = 495
Left = 5760
TabIndex = 4
Top = 5400
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "停止"
Height = 1095
Left = 480
TabIndex = 3
Top = 5520
Width = 2055
End
Begin VB.TextBox Text1
Height = 4695
Left = 480
MultiLine = -1 'True
TabIndex = 1
Top = 600
Width = 8775
End
Begin VB.CommandButton Command1
Caption = "运行"
Height = 1095
Left = 7200
TabIndex = 0
Top = 5520
Width = 2055
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "..."
Height = 180
Left = 2640
TabIndex = 5
Top = 5520
Width = 495
End
Begin VB.Label Label1
Caption = "主程序"
Height = 255
Left = 480
TabIndex = 2
Top = 240
Width = 855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Pid As Long
Dim Code As String
Private Sub Command1_Click()
Code = Text1.Text
Pid = Shell(Code, Check1.Value)
Label3.Caption = Pid
SaveSetting "vbman", "ShellPlus", "Pid", Pid
SaveSetting "vbman", "ShellPlus", "Code", Code
End Sub
Private Sub Form_Load()
Pid = GetSetting("vbman", "ShellPlus", "Pid", 0)
Code = GetSetting("vbman", "ShellPlus", "Code", "")
Label3.Caption = Pid
Text1.Text = Code
End Sub
Private Sub Text1_DblClick()
Text1.Text = ""
End Sub
Private Sub Command2_Click()
Shell "taskkill /f /pid " & Pid, vbHide
Label3.Caption = ""
End Sub