Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

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 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>