Autor Beitrag
ebber
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 239
Erhaltene Danke: 1

Win XP, Win 7
C# (VS 2010), Delphi (2007), Expression 4
BeitragVerfasst: Di 20.05.08 19:26 
Hallo

ich möchte einen Prozess starten und dann benachrichtigt werden, wenn dieser wieder beendet wurde.

ausblenden C#-Quelltext
1:
2:
3:
            System.Diagnostics.Process prcDmy;
            prcdmy = System.Diagnostics.Process.Start(filename);
            prcdmy.Exited += new EventHandler(prcDmy_Exited);


So wird der Prozess gestartet. Das Event wird aber nie aufgerufen. Ist es das falsche oder wie geht das sonst?

MfG
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4799
Erhaltene Danke: 1059

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mi 21.05.08 09:57 
Schau dir die Hilfe zu "Exited" genau an.

Du kannst alternativ "WaitForExit()" verwenden (synchrones Warten).
Aber in beiden Fällen mußt du "EnableRaisingEvents = true" setzen.
ebber Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 239
Erhaltene Danke: 1

Win XP, Win 7
C# (VS 2010), Delphi (2007), Expression 4
BeitragVerfasst: Mi 21.05.08 13:16 
Danke, es funktioniert.

Man sollte auch das Kleingedruckte lesen :

Zitat:

"This event can occur only if the value of the EnableRaisingEvents property is true."


MfG