检测 regedit.exe 是否打开

Detect if regedit.exe is open

我知道如何通过 VB.NET 中的标题名称检测 windows 并且有效

If p.MainWindowTitle.Contains("Registry") Then

但是注册表编辑器在每种语言中都有不同的名称,所以我如何通过 ProcessName 检测到“regedit.exe”?

我这样试过,但似乎根本不起作用:

If p.ProcessName.Contains("regedit") Then

If p.StartInfo.FileName.Contains("regedit") Then

那我怎么检测呢?

您可以使用方法 GetProcessesByName:

获取所有 regedit.exe 个进程
System.Diagnostics.Process.GetProcessesByName("regedit")

这个returns一个Process的数组。