Executing multiple external apps at the same time lazarus / 13-General ---------------------------------------------------------------------- Sean · 2007-01-31 03:14 Hello I was wondering if it is possible launching two different apps at the same time. I used sysutils.executeprocess. But it waits on the first app before the second one launching. Is there a way to get around this? ---------------------------------------------------------------------- Vincent Snijders · 2007-01-31 06:40 Use TProcess. For examples see http://wiki.lazarus.freepascal.org/Executing_External_Programs ---------------------------------------------------------------------- Danail · 2007-02-01 19:34 Yep TProcess is nice for executing external files. I made it in one my aplication that executes Internet Explorer for going to a page automatically and together executing a text editor and opens a folder for futire saved text with internet explorer again - so there are 3 external executed progs without problems.  Here a sample code:  Don't forget to add Process to the Uses section, and to add the  processes in the var section.  var  AProcess1: TProcess;  AProcess2: TProcess;  AProcess3: TProcess;  A code example:  begin  {starting the firs executable. }  AProcess1 := TProcess.Create(nil);  AProcess1.CommandLine := 'C:\Dir1\EXE1.exe';  AProcess1.Execute;  AProcess1.Free;  {starting the second executable. }  AProcess2 := TProcess.Create(nil);  AProcess2.CommandLine := 'C:\Dir2\EXE2.exe';  AProcess2.Execute;  AProcess2.Free;  {starting the third executable. }  AProcess3 := TProcess.Create(nil);  AProcess3.CommandLine := 'C:\Dir3\EXE3.exe';  AProcess3.Execute;  AProcess3.Free;  end; ---------------------------------------------------------------------- Zink · 2007-02-02 16:43 If you don't need to keep information about the apps you can use WinExec() (Win API function). It's just one line, it doesn't require any object creating/destroying. ---------------------------------------------------------------------- Danail · 2007-02-02 19:26 WinExec('the path to the exe');  is really easier, but it doesn't work on Linux, this is why I am recomending TProcess. ---------------------------------------------------------------------- Almindor · 2007-02-03 09:54 Don't use winapi guys, you could just as well go back to Delphi then. Even if you don't use or target linux or freeBSD now, it's best to go the few extra lines and keep the code clean. TProcess is also much more powerfull, keeping info etc. ---------------------------------------------------------------------- RudieD · 2007-02-05 11:18 If the app that you execute generate a lot of output how can I redirect the output to a file and still be able to check when the app has finished and what the Exit code were ? ---------------------------------------------------------------------- Danail · 2007-02-05 19:23 Try the pipes. With the pipes you can redirect the output in a text file.