Get TaskBar Windows
Posted: Tue Oct 27, 2009 4:26 pm
Hello,
Because I have released the source-code to AppIconBarv3 which uses the following code I have moved this from the VIP 'First Look' section for general viewing.
Here is a nice easy way to get a complete list off Windows/Applications that are open on the taskbar.
First start a new project or use an existing project and add a "ListBox" control to the form.
Then in code-view add this underneath "Public Class Form..":
This one will get a list off all windows 'Titles'
Happy coding! cooll;
Because I have released the source-code to AppIconBarv3 which uses the following code I have moved this from the VIP 'First Look' section for general viewing.
Here is a nice easy way to get a complete list off Windows/Applications that are open on the taskbar.
First start a new project or use an existing project and add a "ListBox" control to the form.
Then in code-view add this underneath "Public Class Form..":
Code: Select all
Then inside the "Form_Load" event or whichever event you wish to use to get the list just add this code:<System.Runtime.InteropServices.DllImport("user32.dll")> _
Shared Function ShowWindow(ByVal handle As IntPtr, ByVal nCmd As Int32) As Boolean
End Function
<System.Runtime.InteropServices.DllImport("user32.dll")> _
Shared Function SetForegroundWindow(ByVal hWnd As IntPtr) As Boolean
End Function
Code: Select all
Change the line that says "ListBox1.Items.Add..." to one of the following to get the required result:For Each TaskPro As Diagnostics.Process In Diagnostics.Process.GetProcesses
If TaskPro.MainWindowTitle <> Nothing Then
ListBox1.Items.Add(TaskPro.MainWindowTitle)
End If
Next
This one will get a list off all windows 'Titles'
Code: Select all
This one will get a list off all the programs used by the windows (notepad, Paint etc)
ListBox1.Items.Add(TaskPro.MainWindowTitle)
Code: Select all
Thats all there is to it ;) ListBox1.Items.Add(TaskPro.ProcessName)
Happy coding! cooll;