我正在构建一个应用程序,以便在运行特定程序时将我的 Skype 状态更改为忙。我尝试了以下代码:
Private Sub WaitTimer_Tick(sender As Object, e As EventArgs) Handles WaitTimer.Tick
For Each Me.Process In Process.GetProcesses(My.Computer.Name)
On Error Resume Next
If Process.ProcessName = Process.ProcessName = "SCII" Then
skype.Changeuserstatus(TUserStatus.cusAway)
Button1.Text = "SCII is running"
Exit Sub
End If
Next
Button1.Text = "SCII is not running"
End Sub
每当我运行它时,它总是说 SCII 是打开的,而它不是。我究竟做错了什么?除了计时器之外,还有更好更有效的方法来检查正在运行的进程吗?
作为旁注,我导入 Skype4COMLib。