您现在的位置:首页 >> 基础算法 >> window基础 >> 内容

Delphi中GetTickCount函数原型及其用途

时间:2011/9/3 15:35:03 点击:

  核心提示:【说明】 用于获取自windows启动以来经历的时间长度(毫秒)【返回值】 Long,以毫秒为单位的windows运行时间通常用来计算某个操作所使用的时间: Start:=GetTickCount;...

【说明】  用于获取自windows启动以来经历的时间长度(毫秒)
【返回值】  Long,以毫秒为单位的windows运行时间

通常用来计算某个操作所使用的时间:  
  Start:=GetTickCount;  
  ...//执行耗时的操作  
  Stop:=GetTickCount;  
  TimeUsed:=(Stop-Start)/1000;     //使用了xxx秒

  也可以用来做延时程序:  
  Procedure   TForm1.Delay(Msecs:   Integer);  
  var  
      firstTickCount   :   real;  
  begin  
      firstTickCount   :=   GetTickCount;  
      Repeat  
      Until   ((GetTickCount   -   firstTickCount)   >=   longInt(Msecs));  
  end;

作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号