[英]VB.NET using ProcessName
I created a program with functions read an application by process name ... 我创建了一个程序,该程序具有按进程名称读取应用程序的功能...
When Calc.exe is run Label31 changed from CLOSE into the OPEN, but when I close Calc.exe Label31 do not want to change back from OPEN into the CLOSE... 运行Calc.exe时,Label31从CLOSE更改为OPEN,但是当我关闭Calc.exe Label31时,不想从OPEN更改回CLOSE...。
My Code 我的密码
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
Dim myProcess() As Process = System.Diagnostics.Process.GetProcessesByName("calc")
For Each Read As Process In myProcess
Label31.Text = "OPEN"
Next
End Sub
anyone can help me how to calc when closed label31 changed from OPEN into CLOSE? 有人可以帮我计算关闭的label31从OPEN变为CLOSE时的计算方式吗?
If you're polling then just do: 如果您要进行轮询,则只需执行以下操作:
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
Dim myProcess() As Process = System.Diagnostics.Process.GetProcessesByName("calc")
Label31.Text = If(myProcess.Length > 0, "OPEN", "CLOSED")
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.