BlueGEEK Journal

Accueil > Manip’s > Delphi > JEDI Librairie > jvCreateProcess : Rediriger les Sorties Console vers l’Application (...)

jvCreateProcess

jvCreateProcess : Rediriger les Sorties Console vers l’Application Delphi

mercredi 28 octobre 2009, par bluegyn_spip

Comment récupérer dans une application les messages émis par une console DOS ?

- Installer la Librairie JEDI

- Onglet composant NON VISUAL

  • jvCreateProcess

Paramétrage


- Lancer une ligne de commande

form1.JvCreateProcess1.CommandLine := CMD;

form1.JvCreateProcess1.run;

- Récupérer les lignes de sortie

- Armer la Redirection

- ConsoleOptions

  • coRedirect = True

- Evènement OnRead

procedure TForm1.JvCreateProcess1Read(Sender: TObject; const S: String;

 const StartsOnNewLine: Boolean);

begin



Memo1.Lines.Add( S );



end;

- Lancer un code de fin

- OnTerminate

procedure TForm1.JvCreateProcess1Terminate(Sender: TObject;

 ExitCode: Cardinal);

begin



MessageDLG('Tranfert terminé', mtInformation, [mbOK],0);



end;

- Cacher la fenêtre MS-DOS

StartUpInfo

DefaultWindow : False

ShowWindow : swHide