Process -Récupérer et afficher l'output
Bonjour,
Je n'arrive pas à afficher le standard output d'un process (ffmpeg.exe: il s'agit d'une appli fenêtrée pour convertir des vidéos au format flv), je ne comprends vraiment pas pourquoi, mon code simplifié ressemble à cela :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
this.proc = new Process();
this.proc.EnableRaisingEvents = false;
this.proc.StartInfo.FileName = this.path+"\\ffmpeg.exe";
this.proc.StartInfo.UseShellExecute = false;
this.proc.StartInfo.CreateNoWindow = true;
this.proc.StartInfo.RedirectStandardOutput = true;
this.proc.StartInfo.RedirectStandardError = true;
this.proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
this.proc.OutputDataReceived += new DataReceivedEventHandler(this.readOutput);
this.proc.ErrorDataReceived += new DataReceivedEventHandler(this.readOutput);
this.proc.Start();
this.proc.WaitForExit();
this.proc.Close();
private void readOutput(object sender, DataReceivedEventArgs e)
{
this.result.AppendText(e.Data); // result = RichTextBox
} |
J'ai essayé multiples façons (sans gérer avec l'écouteur par exemple) rien à faire, comme dans les exemples que j'ai trouvé (y compris avec FFMPEG) tout le monde semblait +/- faire comme cela, je m'interroge :)
Merci de votre aide !