Warum ist mein Prozess ist Beendet Methode nicht aufgerufen wird?
Ich habe folgenden code, aber warum ist das ProcessExited
- Methode wird nie aufgerufen? Es ist das gleiche, wenn ich nicht eine Verwendung der Windows-shell (startInfo.UseShellExecute = false
).
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.FileName = path;
startInfo.Arguments = rawDataFileName;
startInfo.WorkingDirectory = Util.GetParentDirectory(path, 1);
try
{
Process correctionProcess = Process.Start(startInfo);
correctionProcess.Exited += new EventHandler(ProcessExited);
correctionProcess.WaitForExit();
status = true;
}
.....
internal void ProcessExited(object sender, System.EventArgs e)
{
//print out here
}
InformationsquelleAutor der Frage 5YrsLaterDBA | 2010-12-21
Du musst angemeldet sein, um einen Kommentar abzugeben.
Damit erhalten Sie einen Rückruf auf
Exited
Veranstaltung, dieEnableRaisingEvents
muss auf true gesetzt sein.InformationsquelleAutor der Antwort Elisha
Vom MSDN:
Setzen Sie diese Eigenschaft auf true?
InformationsquelleAutor der Antwort CodingGorilla
Müssen Sie
Process.EnableRaisingEvents
zutrue
.InformationsquelleAutor der Antwort Sam B
Set correctionProcess.EnableRaisingEvents = true
InformationsquelleAutor der Antwort Gary L Cox Jr