Baseult
Baseult

Reputation: 41

Detect if regedit.exe is open

I know how to detect windows by title name in VB.NET and it works

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

But the Registry editor has a different name in each language, so how can I detect "regedit.exe" by ProcessName?

I tried it that way, but it doesn't seem to work at all:

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

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

So how can I detect it?

Upvotes: 0

Views: 96

Answers (1)

MatSnow
MatSnow

Reputation: 7527

You can get all regedit.exe processes with the method GetProcessesByName:

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

This returns an array of Process.

Upvotes: 1

Related Questions