Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Processi vb.NET - MainForm.vb

MainForm.vb

Caricato da:
Scarica il programma completo

  1. 'task_manager in vb.net
  2. ' Autore: Dark_Limit
  3. ' Data: 15/01/2008
  4. ' Ora: 21.24
  5. '
  6.  
  7. 'importo la classe :
  8. Imports System .Diagnostics .Process
  9.  
  10. Public Partial Class MainForm
  11.        
  12.         Public Sub New()
  13.                
  14.                 'inizializzazione dei componenti
  15.                
  16.                 Me.InitializeComponent()
  17.                
  18.                 Me.button2 . Enabled  = False
  19.                
  20.                 Me.button4 . Enabled  = False
  21.                
  22.         End Sub
  23.        
  24.         Sub Button1Click(ByVal sender As Object, ByVal e As EventArgs)
  25.                 'utilizzo la classe precedentemente importata
  26.                 ' e visualizzo i processi
  27.                
  28.                 Dim  prc  As  Process ()
  29.                
  30.                 Dim prop As Integer
  31.                
  32.                 Dim priority As Integer
  33.                
  34.                
  35.          prc = Process . GetProcesses ()
  36.          
  37.          Me . listBox1 . Sorted = False
  38.          
  39.          Dim  tgr  As  Integer
  40.          
  41.          For tgr = 0 To prc.Length - 1  'finchè il processo esiste lo carico nella lista
  42.                
  43.                 'proprietà del processo
  44.                
  45.                 prop=prc(tgr).Id
  46.                
  47.                 priority=prc(tgr).BasePriority
  48.                
  49.            Me . listBox1 . Items . Add  ("Nome :  " + prc(tgr).ProcessName + ".exe"+"  "+"  "+"--->"+"PID : " + prop.ToString +" "+"  "+"--->"+"Priorità : " + priority.ToString  )
  50.      
  51.                      Next
  52.                      
  53.                     ' disabilito gli oggetti
  54.                    
  55.                       Me. button1 . Enabled = False
  56.                      
  57.                       Me. button2 . Enabled = True
  58.                      
  59.                       Me. button4 . Enabled = True
  60.                      
  61.         End Sub
  62.        
  63.        
  64.                
  65.        
  66.        
  67.         Sub Button2Click(ByVal sender As Object, ByVal e As EventArgs)
  68.                
  69.                 ' Pulitura Lista elementi
  70.                
  71.                 Me . button1 . Enabled = True
  72.                
  73.                 Me . listBox1 . Items . Clear ()
  74.                
  75.                 Me . button2 . Enabled = False
  76.                
  77.                 Me . button4 . Enabled = False
  78.                
  79.         End Sub
  80.        
  81.         Sub Button3Click(ByVal sender As Object, ByVal e As EventArgs)
  82.                
  83.                 ' Ordinazione lista elementi
  84.                
  85.                         If Me . listBox1 . sorted = False  Then
  86.                                
  87.                         Me . listBox1 .sorted = True
  88.                        
  89.                         Me . label2 . Text  =  "Lsta elementi Ordinata!"
  90.                        
  91.                         End If
  92.                        
  93.         End Sub
  94.        
  95.         Sub Button4Click(ByVal sender As Object, ByVal e As EventArgs)
  96.                
  97.                 ' Refresh della lista
  98.                
  99.                      Me.listBox1.Items.Clear()
  100.                      
  101.                      Dim  prc  As  Process ()
  102.                      
  103.                      Dim prop As Integer
  104.                      
  105.                      Dim priority As Integer
  106.                      
  107.              prc = Process . GetProcesses ()
  108.          
  109.               Me . listBox1 . Sorted = False
  110.          
  111.               Dim  tgr  As  Integer
  112.          
  113.                   For tgr = 0 To prc.Length - 1 ' finchè il processo esiste lo carico nella lista
  114.                        
  115.                            ' Proprietà processi
  116.                            
  117.                              prop=prc(tgr).Id
  118.                              
  119.                              priority=prc(tgr).BasePriority
  120.                              
  121.            Me . listBox1 . Items . Add  ("Nome :  " + prc(tgr).ProcessName + ".exe"+"  "+"  "+"--->"+"PID : " + prop.ToString +" "+" "+"--->"+"Priorità : "+priority.ToString  )
  122.      
  123.                      Next
  124.                      
  125.                     ' disabilito gli oggetti
  126.                    
  127.                       Me. button1 . Enabled = False
  128.                      
  129.                      
  130.                              
  131.         End Sub
  132.        
  133.  
  134. End Class