答案 0 :(得分:0)
经过无休止的搜索,人们几乎无益,100%的选票,我终于向你提出了解决方案!适用于VB.Net!简单制作标签,插入此代码。繁荣。所有代码都是ReadWritingMemory.vb中的原始代码。
Public Class Form1
Dim Timer1 As New Timer
Public Function IsProcessRunning(Notepad As String) As Boolean
For Each clsProcess As Process In Process.GetProcesses()
If clsProcess.ProcessName.StartsWith(Notepad) Then
Return True
Else
End If
Next
Return False
End Function
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim Run As Integer
If Run = 0 Then
AddHandler Timer1.Tick, AddressOf Timer1_Tick
Timer1.Interval = 1
Timer1.Start()
Else
RemoveHandler Timer1.Tick, AddressOf Timer1_Tick
Timer1.Stop()
End If
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs)
Dim p() As Process
p = Process.GetProcessesByName("notepad")
If p.Count > 0 Then
Label1.Text = "Status: Notepad Running!"
Label1.Refresh()
Else
Label1.Text = "Status: Notepad Not Running!"
Label1.Refresh()
End If
End Sub
End Class
请确保将ReadWritingMemory.vb添加到您的班级。 找到的代码here。
视觉背景: