Bonjour j'aimerai récupérer les nom des processus en cours et les afficher dans une listBox
voila mon code :
Ce code ne m'affiche rien et je ne comprend pas pourquoi
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 public void listingProcess() { try { listBox1.Items.Clear(); System.Diagnostics.Process[] prcBackup = Process.GetProcessesByName("COMBackup"); System.Diagnostics.Process[] prcIndexer = Process.GetProcessesByName("COMIndexer"); System.Diagnostics.Process[] prcNotifier = Process.GetProcessesByName("COMSTNotifier"); System.Diagnostics.Process[] prcPManager = Process.GetProcessesByName("COMSTProfileManager"); System.Diagnostics.Process[] prcEMonitor = Process.GetProcessesByName("EventMonitor"); System.Diagnostics.Process[] prcPCALauncher = Process.GetProcessesByName("PCALauncher"); for (int i = 0; i < prcBackup.Length; i++) { listBox1.Items.Add(prcBackup[i].StartInfo.FileName); } for (int i = 0; i < prcIndexer.Length; i++) { listBox1.Items.Add(prcIndexer[i].StarInfo.FileName); } for (int i = 0; i < prcNotifier.Length; i++) { listBox1.Items.Add(prcNotifier[i].StartInfo.FileName); } for (int i = 0; i < prcPManager.Length; i++) { listBox1.Items.Add(prcPManager[i]); } for (int i = 0; i < prcEMonitor.Length; i++) { listBox1.Items.Add(prcEMonitor[i].StartInfo.FileName); } for (int i = 0; i < prcPCALauncher.Length; i++) { listBox1.Items.Add(prcPCALauncher[i].StartInfo.FileName); } } catch (Exception ex) { MessageBox.Show("Error : " + ex, "Issue", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
si je remplace
par
Code : Sélectionner tout - Visualiser dans une fenêtre à part listBox1.Items.Add(prcPCALauncher[i].StartInfo.FileName);
ça m'affiche
Code : Sélectionner tout - Visualiser dans une fenêtre à part listBox1.Items.Add(prcPCALauncher[i].ToString());
mais ce n'est pas tout a fait ce que je veux.System.Diagnostics.Process(PCALauncher)
merci de votre aide.
Partager