【发布时间】:2013-12-13 16:14:22
【问题描述】:
我正在创建一个需要运行的程序,然后等待 10 分钟再继续
procedure firstTimeRun(const document: IHTMLDocument2);
var
fieldValue : string;
StartTime : Dword;
begin
StartTime := GetTickCount();
WebFormSetFieldValue(document, 0, 'Username', '*******');
WebFormSetFieldValue(document, 0, 'Password', '*******');
WebFormSubmit(document, 0);
if (GetTickCount() >= StartTime+ 600000) then
begin
SecondRun();
end;
end;
我遇到的问题是,当我到达 if 语句时,它会检查它是否不正确,然后继续我如何让它保持不变并等到该语句为真?
【问题讨论】:
-
你不能使用 TTimer 吗?
-
注意,如果你在主线程中运行它,它会阻塞 UI(10 分钟!)。如果是这样,请不要使用建议的方式,也不要尝试通过调用
Application.ProcessMessages来“修复”该块。
标签: delphi timer wait gettickcount