I have code like:
begin
RunProgram:=TProcess.Create(nil);
RunProgram.Commandline:='calc.exe';
RunProgram.Execute;
RunProgram.Commandline:='notepad.exe';
RunProgram.Execute;
RunProgram.Free;
end.
and I would like to put a sleep or delay after executing calc.exe
You had the right idea - it's Sleep
.
begin
RunProgram:=TProcess.Create(nil);
RunProgram.Commandline:='calc.exe';
RunProgram.Execute;
Sleep(1000); // Adds a 1 second delay
RunProgram.Commandline:='notepad.exe';
RunProgram.Execute;
RunProgram.Free;
end.
You may need to add the Windows
unit (or possibly a different one - I'm not familiar with FreePascal's unit arrangement) to your uses
clause to be able to compile the Sleep
function.