首页 > 解决方案 > 检测regedit.exe是否打开

问题描述

我知道如何在 VB.NET 中通过标题名称检测窗口并且它有效

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

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

我尝试过这种方式,但它似乎根本不起作用:

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

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

那么我该如何检测呢?

标签: vb.netregedit

解决方案


您可以使用以下方法获取所有regedit.exe进程GetProcessesByName

System.Diagnostics.Process.GetProcessesByName("regedit")

这将返回一个数组Process


推荐阅读