Connecting Tech Pros Worldwide Forums | Help | Site Map

Process Description Name

Newbie
 
Join Date: Jul 2009
Posts: 2
#1: Jul 21 '09
I'm currently working with this piece of code:


Expand|Select|Wrap|Line Numbers
  1. CheckedListBox1.Items.Clear()
  2. CheckedListBox1.DisplayMember = "ProcessName"
  3. Dim p As Process
  4. For Each p In Process.GetProcesses
  5. CheckedListBox1.Items.Add(p)
  6. Next

But what it is doing is getting the actual .exe name of the process - example "dwm.exe".
I want it to give the file description of the .exe - example instead of "dwm.exe" the description of dwm.exe is "Desktop Window Manager" and I want that file description to show up in the checkedliskbox instead of the .exe name.

Is this possible to get a list of the running process and show the file description name instead of the .exe name?

Please help!

MrMancunian's Avatar
Expert
 
Join Date: Jul 2008
Location: Utrecht, The Netherlands
Posts: 283
#2: Jul 22 '09

re: Process Description Name


Hi,

I've been searching, but it seems there is no way to find the description of the processes running. It's not a property of Process. As you can't extract the full path of the process running, you also can't use the System.IO.FileInfo.

I think you have something in mind like the tasklist in the taskmanager. I think that list is created based on all open windows. Like I said, I don't think it can be done, but perhaps there is someone else who knows a solution.

Cheers,

Steven
Newbie
 
Join Date: Jul 2009
Posts: 2
#3: Jul 23 '09

re: Process Description Name


Actually there is a way, I finally figured it out, here is the code if you are curious:


Expand|Select|Wrap|Line Numbers
  1.  #
  2. For Each p As Process In Process.GetProcesses
  3. #
  4.             Try
  5. #
  6.                 Dim ProcessFile = FileVersionInfo.GetVersionInfo(p.MainModule.FileName)
  7. #
  8.                 CheckedListBox1.Items.Add(ProcessFile.FileDescription)
  9. #
  10.             Catch ex As System.ComponentModel.Win32Exception
  11. #
  12.                 If ex.Message = "Access is denied" Then
  13. #
  14.                 Else
  15. #
  16.                     'error handling
  17. #
  18.                 End If
  19. #
  20.             End Try
  21. #
  22.         Next
Reply

Tags
.exe, checkedlistbox, filedescription, process