Support Forums
[Source] Get Startup and Running Process - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: [Source] Get Startup and Running Process (/showthread.php?tid=18711)



[Source] Get Startup and Running Process - euverve - 05-12-2011

Just a simple viewer.

[Image: Dz9QO.png]

Full Codes:
Code:
Imports Microsoft.Win32

Public Class Autostart

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        GetAutoRuns()
        process()
    End Sub

    Sub GetAutoRuns()
        ' Local Machine
        Dim rkLocalMachine As RegistryKey = Registry.LocalMachine
        Dim rklocal As RegistryKey = rkLocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")

        For Each valueName As String In rklocal.GetValueNames()
            Dim key As String = rklocal.Name
            Dim skey As String = valueName
            Dim keyvalue = rklocal.GetValue(valueName).ToString()

            Dim str(3) As String
            Dim itm As ListViewItem
            str(0) = skey
            str(1) = keyvalue
            str(2) = key
            itm = New ListViewItem(str)
            ListView1.Items.Add(itm)
        Next

        ' Current User
        Dim rkCurrentUser As RegistryKey = Registry.CurrentUser
        Dim rkcurrent As RegistryKey = rkCurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")

        For Each valueName As String In rkcurrent.GetValueNames()
            Dim key As String = rkcurrent.Name
            Dim skey As String = valueName
            Dim keyvalue = rkcurrent.GetValue(valueName).ToString()

            Dim str(3) As String
            Dim itm As ListViewItem
            str(0) = skey
            str(1) = keyvalue
            str(2) = key
            itm = New ListViewItem(str)
            ListView1.Items.Add(itm)
        Next
    End Sub

    Sub process()

        Try
            Dim psList() = System.Diagnostics.Process.GetProcesses()

            For Each p As Process In psList
                Dim str(6) As String
                Dim itm As ListViewItem

                str(0) = p.MainModule.ModuleName
                str(1) = p.Id.ToString()
                str(2) = p.BasePriority
                str(3) = p.Responding
                str(4) = p.Threads.Count
                str(5) = p.MainModule.FileName
                itm = New ListViewItem(str)
                ListView2.Items.Add(itm)
            Next p

        Catch ex As Exception

        End Try

    End Sub

End Class