16,748
社区成员
发帖
与我相关
我的任务
分享
function TForm1.myfun(x, y: Integer): Integer;
begin
Result:=x+y;
end;
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;