thd.~pas

来自「初学DELPHI编写的“奖学金评定系统”」· ~PAS 代码 · 共 133 行

~PAS
133
字号
unit Thd;

interface

uses
  Classes;

type
  TThd = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
    function exec(): boolean;virtual;abstract;
  public
    constructor create();
  end;

  TXueJiCL = class(TThd)
  protected
    function exec(): boolean;override;
  end;

  TChengJiCL = class(TThd)
  protected
    function exec(): boolean;override;
  end;

  TdyzhCLAuto = class(TThd)
  protected
    function exec(): boolean;override;
  end;

  TAddData = class(TThd)
  protected
    function exec(): boolean;override;
  end;

  TOutput = class(TThd)
  protected
    function exec(): boolean;override;
  end;

implementation

uses zhUnit, useDLL;

procedure TThd.Execute;
begin
  exec();
end;

constructor TThd.create();
begin
  freeonterminate:= true;
  inherited create(false);
end;

function TChengJiCL.exec(): boolean;
begin
  with mainform do begin
      label2.caption:= '成绩信息录入中';
      update;
    if ChengJiCL() then begin
      if terminated then
        exit;
      edit2.Enabled:= false;
      label2.caption:= '成绩信息录入完毕';
      update;
    end;
  end;
end;

function TXueJiCL.exec(): boolean;
begin
  XueJiCL();
  {
  with mainform do begin
    label2.caption:= '学籍信息录入中';
    update;

    if XueJiCL() then begin
      if terminated then
        exit;
      label2.caption:= '学籍信息录入完毕';
      update;
    end;
  end;
  }
end;

function TdyzhCLAuto.exec(): boolean;
begin
  with mainform do begin
      label2.caption:= '得分信息录入中';
      update;
    if dyzhCLAuto() then begin
      if terminated then
        exit;
      label2.caption:= '得分信息录入完毕';
      update;
    end;
  end;
end;

function TAddData.exec(): boolean;
begin
  with mainform do begin
      label2.caption:= '正在综合处理成绩';
      update;
    if AddData() then begin
      if terminated then
        exit;
      label2.caption:= '所有成绩信息输入完成';
      update;
    end;
  end;
end;

function TOutput.exec(): boolean;
begin
  with mainform do begin
      label2.caption:= '正在输出成绩';
      update;
    if Output() then begin
      label2.caption:= '成绩信息输出完成';
      update;
    end;
  end;
end;

end.     

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?