Note that there are some explanatory texts on larger screens.

plurals
  1. PO.NET Process issues with Windows XP
    primarykey
    data
    text
    <p>First off, I am using my own Process Wrapper to hold the starting path of a process.</p> <pre><code>public class MCProcess() { public Process Process { get; set;} public string StartingPath { get; set;} public MCProcess(string start, Process p) { Process = p; StartingPath = start; } } </code></pre> <p>Now, I keep have a <code>List&lt;MCProcces&gt;</code> called runningProcesses that I use to keep track of all the processes and starting paths of every process that my program has started.</p> <p>For Example:</p> <pre><code>string path = "C:\\Windows\\System32\\notepad.exe"; Process temp = Process.Start(path); runningProcesses.Add(new MCProcess(path, temp)); </code></pre> <p>Now, sometimes, I want to close processes that I have run. Instead of looking through the task manager and trying to find the MainModuleName of each process that I started, I included the StartingPath for a reason.</p> <p>If I want to close a notepad, I just loop through my runningProcesses, find out which process has the startingPath for notepad and then use Process.Kill to kill that process.</p> <pre><code>string path = "C:\\Windows\\System32\\notepad.exe"; for (int i = 0; i &lt; runningProcesses.Count; i++) { if (runningProcesses[i].StartingPath == path) { runningProcesses[i].Process.Kill(); runningProcesses.RemoveAt(i); } } </code></pre> <p>This code works beautiful on Windows 7 and I have had no issues at all. However, when using this on Windows XP, I get an ArgumentNullException with Process.Kill.</p> <p>Is there something about the Process class that doesn't make it work well on Windows XP?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload