to fyx :
你从哪下的mwFastTime,我是从另一个站点下载的,没有那两句!
只有
:unit mwFastTime;
interface
uses
Windows, SysUtils, Classes;
type
TmwFastTime = class(TComponent)
private
c, n1, n2: TLargeInteger;
FElapsedTime : ShortString;
protected
public
constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
Property ElapsedTime : ShortString read FElapsedTime;
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);
FElapsedTime := '';
end;
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
destructor TmwFastTime.Destroy;
begin
inherited Destroy;
end;
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
Procedure TmwFastTime.Start;
begin
QueryPerformanceFrequency(c);
QueryPerformanceCounter(n1);
end;
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
Procedure TmwFastTime.Stop;
begin
QueryPerformanceCounter(n2);
<font color="#FFFFFF">
这出错
FElapsedTime:= format('Seconds: %g', [(n2.QuadPart - n1.QuadPart)/ c.QuadPart]);
</font>
end;
end.