现在的位置: 首页 > 综合 > 正文

线程

2013年03月13日 ⁄ 综合 ⁄ 共 360字 ⁄ 字号 评论关闭
type
  TMyThread = class(TThread)
  private
    FX, FY: Integer;
  protected
    procedure Execute; override;
  public
    constructor Create(const x,y: Integer);
  end;

{ TMyThread }

constructor TMyThread.Create(const x,y: Integer);
begin
  FX := x;
  FY := y;
  inherited Create(False);
end;

procedure TMyThread.Execute;
begin
  ReturnValue := FX + FY;
end;

  with TMyThread.Create(30, 50) do
  begin
    ShowMessage(IntToStr(WaitFor));
    Free;
  end;

抱歉!评论已关闭.