关于Delphi中多线程传递参数的简单有关问题

关于Delphi中多线程传递参数的简单问题
本帖最后由 kindao2 于 2013-07-09 21:38:25 编辑
unit uThread;

interface

uses
  Classes;

type
  Th = class(TThread)
  private
    { Private declarations }
   
  protected
    procedure Execute; override;
  end;
以上是创建的一个多线程
我在另外一个单元里Unit1有一个函数
function Myfun(username,password:string):boolean

现在要把Myfun放到多线程里执行,怎么传递参数呢?
谁有这样的Demo给一个我,帮我讲解一下,感激不尽!我看到网上说有结构体,因本人才学Delphi没多久,不太懂的,希望大牛们指点迷津!
多线程 Delphi

------解决方案--------------------

// 线程类
unit Unit2;

interface

uses
  Classes;

type
  TMyThread = class(TThread)
  private
    FUserName: string;
    FPassWord: string;
    FFlag: Boolean;
    procedure GetUserName(const Value: string);
    procedure GetPassWord(const Value: string);
    { Private declarations }
  protected
    procedure Execute; override;
  public
    property UserName: string read FUserName write GetUserName;
    property PassWord: string read FPassWord write GetPassWord;
    property MyFunRetVal: Boolean read FFlag default False;
    function Myfun(FUserName, FPassWord: string): Boolean;
    constructor Create(b: Boolean = True);
  end;

implementation

function TMyThread.Myfun(FUserName, FPassWord: string): Boolean;
begin
  Result := True; // 简单起见让它固定为True
end;

constructor TMyThread.Create(b: Boolean = True);
begin
  inherited Create(b);