检查Internet Explorer是否正在运行 [英] Check if internet explorer is running
本文介绍了检查Internet Explorer是否正在运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在绘制一个空白,并且我知道这是错误的
I am drawing a blank and have this which I know is wrong
Dim myProcesses As Process() = Process.GetProcessesByName("iexplore")
Dim myProcess As Process
For Each myProcess In myProcesses
If myProcess.ProcessName.ToString IsNot Nothing Then
MsgBox(myProcess.ProcessName.ToString)
ElseIf myProcess.ProcessName.ToString Is "" Then
MsgBox("closed")
End If
Next myProcess
推荐答案
我认为应该可以.
我发现此 [ ^ ].对我来说就像一个魅力:)
转换为VB:
That should work I think.
I found this[^] using Google. Works like a charm for me :)
Converted to VB:
Public Function IsProcessOpen(ByVal name As String) As Boolean
For Each clsProcess As Process In Process.GetProcesses
If clsProcess.ProcessName.Contains(name) Then
Return True
End If
End If
Return False
End function
这是检查IE的方法:
Here''s how to check for IE:
If IsProcessOpen("iexplore") Then
MessageBox.Show("IE is now open!")
Else
MessageBox.Show("IE is now closed!")
End If
我建议在MsgBox上使用MessageBox,因为MessageBox会替换.NET中的MsgBox :)
希望对您有所帮助!
I recommend use of MessageBox over MsgBox, since MessageBox replaces MsgBox in .NET :)
Hope it helps!
这篇关于检查Internet Explorer是否正在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文