熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Delphi編程 >> 正文

利用Delphi建立精確計數器[2]

2022-06-13   來源: Delphi編程 

  下面是具體的檢測程序

  unit Unit;

  interface

  uses

  Windows Messages SysUtils Classes Graphics Controls Forms Dialogs

  StdCtrls ExtCtrlsmmSystem;

  type

  TForm = class(TForm)

    Edit: TEdit;

    Edit: TEdit;

    Edit: TEdit;

    Button: TButton;

    Button: TButton;

    Timer: TTimer;

    procedure FormCreate(Sender: TObject);

    procedure ButtonClick(Sender: TObject);

    procedure TimerTimer(Sender: TObject);

    procedure ButtonClick(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

  var

  Form: TForm;

  actTimeactTime:Cardinal;

  smmCountsTimerCountsPCount:Single;

  hTimeID:Integer;

  iTen:Integer;

  proTimeCallBack:TFNTimeCallBack;

   procedure TimeProc(uTimerID uMessage: UINT;

    dwUser dw dw: DWORD) stdcall;

  procedure proEndCount;

  implementation

 

  {$R *DFM}

  //timeSetEvent的回調函數

  procedure proEndCount;

  begin

    actTime:=GetTickCountactTime;
  
    FormButtonEnabled :=False;

    FormButtonEnabled :=TRue;

    FormTimerEnabled :=False;

    smmCount:=;

    sTimerCount:=;

    spCount:=;

 

    timeKillEvent(hTimeID);

  end;

 

[]  []  []  []  


From:http://tw.wingwit.com/Article/program/Delphi/201311/25027.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.