Click here to Skip to main content
15,887,850 members
Please Sign up or sign in to vote.
2.60/5 (2 votes)
See more:
Hi all experts,

I don't know it is possible to do this or not and this is my require:
- I run Ms.Access, Ms.Word, Firefox, Crystal Report and other program (total: 7 Programs in my PC)
- I want to capture program name such as: Ms.Access,Ms.Word,Firefox, Crystal Report and other Program Name to one file (text file).

Is it possible to capture those program name using vb.net?

Thanks

TONY
Posted

Do something like..
VB
For Each p As Process In Process.GetProcesses()
   Console.WriteLine(p.ProcessName)
Next

And next write to a text file like:
http://www.homeandlearn.co.uk/NET/nets8p4.html[^]
http://msdn.microsoft.com/en-us/library/6ka1wd3w.aspx[^]
 
Share this answer
 
v3
Comments
Manas Bhardwaj 8-Aug-13 5:04am    
Correct +5!
ridoy 8-Aug-13 5:05am    
Thanks Manas,:)
Yes, it is possible. Try e.g. this:

VB
Dim psList() As Process
   Try
       psList = Process.GetProcesses()

       For Each p As Process In psList
           Console.WriteLine(p.Id.ToString() + " " + p.ProcessName)
       Next p

   Catch ex As Exception
       Console.WriteLine(ex.Message)
   End Try
   Console.ReadKey()
 
Share this answer
 
Comments
ridoy 8-Aug-13 4:59am    
good one,+4
Manas Bhardwaj 8-Aug-13 5:03am    
Yup +5!
Leo Chapiro 8-Aug-13 5:37am    
Thanks dudes! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900