Post: [VB.NET] Get Active Processes and Services
10-25-2010, 12:10 AM #1
Default Avatar
Oneup
Guest
(adsbygoogle = window.adsbygoogle || []).push({}); This kinda works much like Task manager except in this example you can't end the process / service. I do plan on actually making a slimmed down version of task manager in the future so those who get infected with malware and lose rights to use it will still be able to find out what is running and possibly stop the virus from running.

Anywho, we'll start off with our imports:

    Imports System.ServiceProcess


Now to get the active processes and put them into a listbox as well as the services

     Dim processList() As Process
Dim ServiceCon() As ServiceController = ServiceController.GetServices()
Dim saveFile As IO.StreamWriter
Dim eachline As Integer
Try
processList = Process.GetProcesses()
For Each proc As Process In processList
lst_process_list.Items.Add(proc.ProcessName)
Next (proc)

saveFile = New IO.StreamWriter(".\processes.txt")

For i = 0 To lst_process_list.Items.Count - 1
saveFile.WriteLine(lst_process_list.Items.Item(i))
Next
saveFile.Close()

For Each serv As ServiceController In ServiceCon
If serv.Status.ToString() = "Running" Then
lst_service_list.Items.Add(serv.ServiceName)
End If
Next serv

saveFile = New IO.StreamWriter(".\services.txt")
For i = 0 To lst_service_list.Items.Count - 1
saveFile.WriteLine(lst_service_list.Items.Item(i))
Next
saveFile.Close()

Catch ex As Exception



End Try



Not a whole lot to explain here other then it was never finished. There should be some sort of error message if for whatever reason it hits the catch. Also this will save a text tile with the current services and processes running.
04-12-2011, 09:52 PM #2
schnzrs
Do a barrel roll!
Originally posted by zBozzY View Post
mate pointless thread off coures.........

How is this pointless? He is showing some stuff that can be quite useful for .NET programmers.
04-12-2011, 09:54 PM #3
zBozzY
Banned
Originally posted by schnzrs View Post
How is this pointless? He is showing some stuff that can be quite useful for .NET programmers.




obviously not when no one has posted on it :L lol
04-12-2011, 09:55 PM #4
schnzrs
Do a barrel roll!
Originally posted by zBozzY View Post
obviously not when no one has posted on it :L lol

Then why did you bump his post?

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo