请各位帮忙!

解决方案 »

  1.   

    老大就3 分?!! GetTickCount。 一个API。
      

  2.   

    老大不知道就不要讲了,gettickcount 只能精确到毫秒级,根本达不到微妙。
    SDK解释如下:
    The GetTickCount function retrieves the number of milliseconds that have elapsed since Windows was started. DWORD GetTickCount(VOID)
     ParametersThis function has no parameters. Return ValuesIf the function succeeds, the return value is the number of milliseconds that have elapsed since Windows was started. ResThe elapsed time is stored as a DWORD value. Therefore, the time will wrap around to zero if Windows is run continuously for 49.7 days. 
    Windows NT: To obtain the time elapsed since the computer was started, look up the System Up Time counter in the performance data in the registry key HKEY_PERFORMANCE_DATA. The value returned is an 8 byte value. 
      

  3.   

    呵呵,可以的:
    {
    A high-precision counter/timer. Retrieves time differences
                    downto microsec.
    Quick Reference:
                    THPCounter inherits from TComponent.                Key-Methods:
                      Start:    Starts the counter. Place this call just before the
                                code you want to measure.                  Read:     Reads the counter as a string. Place this call just
                                after the code you want to measure.                  ReadInt:  Reads the counter as an Int64. Place this call just
                                after the code you want to measure.
    --------------------------------------------------------------------------------
    }
    unit HPCounter;interfaceuses
      SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
      Forms, Dialogs, StdCtrls, ExtCtrls;type
      TInt64 = TLargeInteger;
      THPCounter = class(TComponent)
    private
      Frequency: TLargeInteger;
      lpPerformanceCount1: TLargeInteger;
      lpPerformanceCount2: TLargeInteger;
      fAbout: string;
      procedure SetAbout(Value: string);
      { Private declarations }
    public
      constructor Create(AOwner: TComponent); override;
      destructor Destroy; override;
      procedure Start;
      function Read: string;
      function ReadInt: TLargeInteger;
      { Private declarations }
    published
      property About: string read fAbout write SetAbout;
      { Published declarations }
    end;
    procedure Register;implementationprocedure Register;
    begin
      RegisterComponents('MAs Prod.', [THPCounter]);
    end;constructor THPCounter.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
      fAbout:= 'Version 1.1, 2000® Mats Asplund, EMail: [email protected], Site: http://go.to/masdp';
    end;destructor THPCounter.Destroy;
    begin
      inherited Destroy;
    end;function THPCounter.Read: string;
    begin
      QueryPerformanceCounter(TInt64((@lpPerformanceCount2)^));
      QueryPerformanceFrequency(TInt64((@Frequency)^));
      Result:=IntToStr(Round(1000000 * (lpPerformanceCount2 -
                           lpPerformanceCount1) / Frequency));
    end;function THPCounter.ReadInt: TLargeInteger;
    begin
      QueryPerformanceCounter(TInt64((@lpPerformanceCount2)^));
      QueryPerformanceFrequency(TInt64((@Frequency)^));
      Result:=Round(1000000 * (lpPerformanceCount2 -
                           lpPerformanceCount1) / Frequency);
    end;procedure THPCounter.SetAbout(Value: string);
    begin
      Exit;
    end;procedure THPCounter.Start;
    begin
      QueryPerformanceCounter(TInt64((@lpPerformanceCount1)^));
    end;end.
    http://lysoft.7u7.net
      

  4.   

    使用方法:
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      HPCounter, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        Edit1: TEdit;
        Label1: TLabel;
        Label2: TLabel;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
    begin
      Edit1.Text:= '';
      Application.ProcessMessages;
      with THPCounter.Create(Self) do
        begin
          Start;
          // Place code to measure here
          Sleep(1000);
          // Place code to measure here
          Edit1.Text:=Read;
          Free;
        end;
    end;end.
    http://lysoft.7u7.net
      

  5.   

    3分就获得这样的答案,实在太便宜了吧?
    是醒目的就给到100分了不给的,下次就不回答了:)
    呵呵http://lysoft.7u7.net
      

  6.   

    ly_liuyang(Liu Yang) 这位仁兄,给出的好像是淡菊资讯工作室的三方控件。
    实现简单,挺好的!
      

  7.   

    谢谢 ly_liuyang(Liu Yang) 给出详尽的代码。
    谢谢各位。