Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27193

VS 2010 [RESOLVED] detect when a process starts?

$
0
0
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


Viewing all articles
Browse latest Browse all 27193

Trending Articles