I'm trying to detect when a certain program is opened, and from searching i found that the way to do it would be using a code as the one below inside a timer.. i just wanted to ask if there was a better way of doing it, or am i doing it correctly?
Code:
Dim processes() As Process
processes = Process.GetProcessesByName("notepad")
For Each Proc In processes
If Not ListBox1.Items.Contains(Proc.Id) Then
ListBox1.Items.Add(Proc.Id)
'do something here
End If
Next