i am trying to list running processes using VS2015 Community but it gives win32 exception any clue what is wrong here ? my objective is to detect and report the idle threads launched by 3rdparty application names of the sub-processes are different !
imports System
imports system.diagnostics
imports system.componentmodel
Try
Dim ps() As Process
ps = System.Diagnostics.Process.GetProcesses()
For Each mp As Process In ps
Debug.WriteLine(mp.MainModule.ToString)
Dim li As New ListViewItem
li = Me.ListView1.Items.Add("TEST")
li.EnsureVisible()
Next
Catch ex As Exception
Debug.Print(ex.Message.ToString)
End Try
error
System.Diagnostics.ProcessModule (iusb3mon.exe)
System.Diagnostics.ProcessModule (NOTEPAD.EXE)
Exception thrown: 'System.ComponentModel.Win32Exception' in System.dll
Access is denied