שתף באמצעות


Get Task Manager running applications list using VB.net 2008

Question

Friday, November 8, 2013 4:21 AM

As subjected i want taskbar manager running applications list with their icons,

please help.

All replies (3)

Friday, November 8, 2013 12:34 PM ✅Answered | 2 votes

Hi,

 You could loop threw all the Processes and get the windows that have a MainWindowTitle and list them. This is not 100% as there could be an app or window that does not have a Title for the window but, is still in the taskbar. To test it create a new form project with 1 ListView and 1 Button on it. Then paste this code in and try it.

Public Class Form1
    Dim ImgList As New ImageList

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListView1.Columns.Add("Programs", 130, HorizontalAlignment.Left)
        ListView1.Columns.Add("Full Path", 320, HorizontalAlignment.Left)
        ListView1.SmallImageList = ImgList 'Uses the ImgList for the icons. 
        ListView1.FullRowSelect = True
        ListView1.View = View.Details
        ListView1.HeaderStyle = ColumnHeaderStyle.Nonclickable
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each proc As Process In Process.GetProcesses
            If proc.MainWindowTitle <> "" Then
                ImgList.Images.Add(Icon.ExtractAssociatedIcon(proc.MainModule.FileName))
                Dim lvi As New ListViewItem(proc.ProcessName, ImgList.Images.Count - 1)
                lvi.SubItems.Add(proc.MainModule.FileName)
                ListView1.Items.Add(lvi)
            End If
        Next
    End Sub
End Class

If you want to get all the processes running on the computer then you can take out the (If proc.MainWindowTitle <> "") part but, you may need to use a Try Catch in place of it to get the processes as there may be some that you are denied access to when trying to get the icon.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each proc As Process In Process.GetProcesses
            Try
                ImgList.Images.Add(Icon.ExtractAssociatedIcon(proc.MainModule.FileName))
                Dim lvi As New ListViewItem(proc.ProcessName, ImgList.Images.Count - 1)
                lvi.SubItems.Add(proc.MainModule.FileName)
                ListView1.Items.Add(lvi)
            Catch ex As Exception
            End Try
        Next
    End Sub

Friday, November 8, 2013 5:54 AM | 1 vote

As subjected i want taskbar manager running applications list with their icons,

please help.

I'm sorry but I can not make grammatical sense of the question you posted as the word subjected is not used accurately in the context it is being use and I don't know what a taskbar manager is or how it would run an applications list with their Icons.

Perhaps you could write the question in your primary language and then run it through google translate to English where it would make more sense then post the translation. And more of an explanation of what you want to do may be helpful also.

Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


Friday, November 8, 2013 7:46 AM

Sir,

i want the running applications list along with their icons on my form using vb.net 2008,

please help me.