我想让程序运行到某个地方时停止十秒钟,请问该用哪个函数,哪个头文件

解决方案 »

  1.   

    var
    I:integer;
    begin
      i:=gettickcount;
      while (Gettickcount-i)<=10000 do
        application.ProcessMessages;//保证消息循环
    end;
      

  2.   

    建议用楼上的,可以作个比较:
    procedure delay(t:dword)
    var
     i:dword;
    begin 
       i:=gettickcount;
       while (gettickcount-i)<t do
         application.processmessages;
    end;
       
    button1onclick(sender:tobject);
    begin
        sleep(60000);//一分钟;
    end;
    button1onclick(sender:tobject);
    begin
        delay(60000);//一分钟;
    end;
    怎么样,第一个象是死机了,第二个没有一点影响!