vb.net - 检测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
那么我该如何检测呢?
解决方案
您可以使用以下方法获取所有regedit.exe
进程GetProcessesByName
:
System.Diagnostics.Process.GetProcessesByName("regedit")
这将返回一个数组Process
。
推荐阅读
- sql - 使用替换和喜欢
- r - 如何在没有for循环的情况下将任意数量的参数传递给R函数?
- python - 如何在 TensorFlow 中使用 make_early_stopping_hook?
- swift - .setTitle() 方法不会改变标题
- string - VB.Net 删除尾随零
- python - Seaborn joint_plot 和边缘组织未对齐
- ruby - Ruby 版本因终端选项卡而异
- powershell - 请解释 get-eventlog 的 Powershell 输出 - 默认输出格式
- java - 将数组排序为子数组
- python - 删除重复行,但保留其数据的并集