可以计算到的控件计算机等级考试

文章作者 100test 发表时间 2010:01:01 09:29:34
来源 100Test.Com百考试题网


  unit mwFastTime.
  interface
  uses
  SysUtils, Windows, Classes.
  type
  TmwFastTime = class(TComponent)
  private
  c, n1, n2: TLargeInteger.
  function GetElapsedTime: ShortString.
  function GetElapsed: Extended.
  protected本文来源:百考试题网
  public
  constructor Create(AOwner: TComponent). override.
  destructor Destroy. override.
  Property Elapsed: Extended read GetElapsed.
  Property ElapsedTime: ShortString read GetElapsedTime.
  Procedure Start.
  Procedure Stop.
  published
  Property Name.
  Property Tag.
  end.
  procedure Register.
  implementation
  {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  procedure Register.
  begin
  RegisterComponents(\mw\, [TmwFastTime]).
  end.
  {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  constructor TmwFastTime.Create(AOwner: TComponent).
  begin
  inherited Create(AOwner).
  QueryPerformanceFrequency(c).
  end.
  {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  destructor TmwFastTime.Destroy.
  begin
  inherited Destroy.
  end.
  {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  function TmwFastTime.GetElapsed: Extended.
  begin
  {$IFDEF VER120}
  Result:= (_LARGE_INTEGER(n2).QuadPart - _LARGE_INTEGER(n1).QuadPart) / _LARGE_INTEGER(c).QuadPart.
  {$ELSE}
  Result:= (n2.QuadPart - n1.QuadPart) / c.QuadPart.
  {$ENDIF}
  end.
  {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  function TmwFastTime.GetElapsedTime: ShortString.
  begin
  {$IFDEF VER120}
  Result := format(\Seconds: %g\, [GetElapsed]).
  {$ELSE}
  Result := format(\Seconds: %g\, [GetElapsed]).
  {$ENDIF}
  end.
  {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  Procedure TmwFastTime.Start.
  begin
  QueryPerformanceCounter(n1).
  end.
  {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  Procedure TmwFastTime.Stop.
  begin
  QueryPerformanceCounter(n2).
  end.
  end.

  编辑特别推荐:

  全国计算机等级考试资料下载

  全国计算机等级考试论坛

  如何应付二级考试中的公共基础知识

  全国计算机等级考试上机考试应试技巧

  百考试题教育全国计算机等级考试在线测试平台



相关文章


关于对象持久类框架的构架设计(Part1)计算机等级考试
DELPHI下汉字输入法的编程及使用计算机等级考试
Delphi编程技巧实例计算机等级考试
截获Delphi中的异常计算机等级考试
可以计算到的控件计算机等级考试
用Delphi发送SMS(手机短消息服务)计算机等级考试
Delphi命令行参数计算机等级考试
怎样修改windows里的开始按钮的位图计算机等级考试
再谈多态:向上映射及VMT_DMT计算机等级考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛