2个回答
推荐于2016-03-29
展开全部
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyInfo As String = "系统正在运行的程序" + vbCrLf
Dim MyProcesses() As Process = Process.GetProcesses()
For Each MyProcess As Process In MyProcesses
If (MyProcess.MainWindowTitle.Length > 0) Then
MyInfo += MyProcess.MainWindowTitle + vbCrLf
End If
Next
Me.Label1.Text = MyInfo
End Sub
Dim MyInfo As String = "系统正在运行的程序" + vbCrLf
Dim MyProcesses() As Process = Process.GetProcesses()
For Each MyProcess As Process In MyProcesses
If (MyProcess.MainWindowTitle.Length > 0) Then
MyInfo += MyProcess.MainWindowTitle + vbCrLf
End If
Next
Me.Label1.Text = MyInfo
End Sub
追问
请问针对单个程序呢,我是想监控单个程序的运行状态,(正常运行/未响应)
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Sub GetPro()
Dim MyInfo As String
Dim MyProcesses() As Process = Process.GetProcesses()
For Each MyProcess As Process In MyProcesses
MyProcess.
If (MyProcess.MainWindowTitle.Length > 0) Then
MyInfo += MyProcess.MainWindowTitle + vbCrLf
End If
Next
End SUb
上面程序可以去取得目前正在运行的程序的标题,根据标题可判断除他的运行状态。
Dim MyInfo As String
Dim MyProcesses() As Process = Process.GetProcesses()
For Each MyProcess As Process In MyProcesses
MyProcess.
If (MyProcess.MainWindowTitle.Length > 0) Then
MyInfo += MyProcess.MainWindowTitle + vbCrLf
End If
Next
End SUb
上面程序可以去取得目前正在运行的程序的标题,根据标题可判断除他的运行状态。
追问
还是不太清楚,能解释一下吗
MyProcess.
追答
myproscess 定义的 一个变量 类型是 process 是指Windows的进程一个类(class)。通过GetProcesses()这个函数取得。该函数的功能就是取得当前正在运行的进程。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询