Elencare tutti i processi attivi




Il Framework .NET e' abbastanza vasto e dotato di classi che ci permettono di ricavare
queste informazioni. Nel nostro esempio faremo riferimento alla classe Process contenuta
nel namespace System.Diagnostic. Dopo aver quindi importato il namespace potremo
scrivere questo codice:
Imports System.Diagnostic
Dim temp As Process()
Temp = Process.GetProcesses()
Dim x As Integer
For x = 0 To temp.Length - 1
Console.WriteLine("Process: " + temp(x).ProcessName)
Next



' CANCELLA WORD


Imports System.DiagnosticS

Sub ChiudiWord()
Dim temp As Process()
temp = Process.GetProcesses()
Dim x As Integer
For x = 0 To temp.Length - 1
Debug.Print(temp(x).ProcessName)
If UCase(temp(x).ProcessName) = "WINWORD.EXE" Or UCase(temp(x).ProcessName) = "WINWORD" Then
temp(x).Kill()
End If
Next










( elencaretuttiiprocessiattivi.html )- by Paolo Puglisi - Modifica del 17/12/2023