English 中文(简体)
我如何在使用帕斯卡实施两个外部方案之间造成拖延/拖延?
原标题:How do I put delay/sleep between executing two external programs using pascal?

I have code like:

begin
    RunProgram:=TProcess.Create(nil);
    RunProgram.Commandline:= calc.exe ;
    RunProgram.Execute;
    RunProgram.Commandline:= notepad.exe ;
    RunProgram.Execute;
    RunProgram.Free;
end.

并且,在执行死刑后,我想睡觉或拖延。

最佳回答

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.

或许需要将<条码>Windows/code>单位(或可能有不同的单位——我不熟悉自由Pascal的单位安排)添加到<条码>。 能够编纂<代码>的条款 睡觉/密码功能。

问题回答

暂无回答




相关问题
Problem with WM_COMMAND on Lazarus/FPC

I have form with MainMenu and I want to intercept when the user selects a command item from a menu. This works in Delphi: type TForm1 = class(TForm) ... // Memo and MainMenu created protected ...

Problem with Splash Screen in Lazarus app

I am porting a Delphi application to FPC/Lazarus and this application shows info in splash screen. When unit has initialization section then this initialization section calls something like: Splash....

Could Free Pascal benefit of something like Apache Maven?

Apache Maven is a very popular build and dependency management tool in the Java open source ecosphere. I did some tests to find out if it can handle compiled Free Pascal / Delphi units and found it ...

TIdHTTP in Indy 10

I used to use Indy back in the Delphi 6 days, and I am playing with Indy 10 now. What I want to do is incredibly simple, but I don t see a simple way of doing it, so I must be missing something. ...

热门标签