好吧,所以我在3号赛事中被困在这一场2天,我仍然无法找到方法。我需要使用它来判断资源管理器是否正在运行,如果没有启动它,我需要这样做的原因是制作一个程序,以防止人们泄漏文件...得到的其余代码只是卡在这一个上。我能想到哪种方法效率不高的唯一方法是将所有进程添加到列表框中并搜索资源管理器,如果它不存在则启动资源管理器。非常感谢您的帮助:)
答案 0 :(得分:0)
Dim sExplorerName As String = "explorer"
Dim oProcessList() As Process
Dim bFound As Boolean = False
' Get a list of all running processes
oProcessList = Process.GetProcesses()
' Check each process to see if it is explorer
For Each oProc As Process In oProcessList
If (sExplorerName = oProc.ProcessName) Then
' We found the explorer process
bFound = True
End If
Next oProc
If bFound = False Then
' Start explorer.exe since it was not found to be running
Process.Start(System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("windir"), "explorer.exe"))
End If