zoukankan      html  css  js  c++  java
  • 一个关于多线程的简单实例(抄书)

    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls;

    type
    TForm1
    = class(TForm)
    lblTime: TLabel;
    btnAdd: TButton;
    edt1: TEdit;
    edt2: TEdit;
    edt3: TEdit;
    lbl1: TLabel;
    lbl2: TLabel;
    procedure btnAddClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;
    timethread
    = class(TThread)
    protected
    procedure execute;override;
    end;
    var
    Form1: TForm1;
    TIME_THREAD:timethread;

    implementation

    {$R *.dfm}

    { timethread }

    procedure timethread.execute;
    var
    go:Boolean;
    timestring:
    string;
    begin
    go:
    =True;
    repeat
    timestring:
    =FormatDateTime('H:mm:ss am/pm',now);
    Form1.lblTime.Caption:
    =timestring;
    until go=False;
    end;

    procedure TForm1.btnAddClick(Sender: TObject);
    begin
    edt3.Text:
    =IntToStr(StrToInt(edt1.Text)+strtoint(edt2.Text));
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    TIME_THREAD:
    =timethread.Create(false);
    end;

    end.

  • 相关阅读:
    Windows 7 SP1无人值守自动应答文件制作
    Ubuntu GNOME单击任务栏图标最小化设置
    NOIP2017题解
    NOIP2017游记
    大模拟1.0
    奇袭
    礼物
    找硬币
    Fiolki
    SQLserver Delete from where 与Oracle delete from where 的差异
  • 原文地址:https://www.cnblogs.com/ljjphysics/p/2121960.html
Copyright © 2011-2022 走看看