留
留香客
Unregistered / Unconfirmed
GUEST, unregistred user!
老是出现Variable Required.错误。
源码如下:
源码如下:
代码:
unit qUnit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, StdCtrls;
type
TForm1 = class(TForm)
SpeedButton1: TSpeedButton;
Label1: TLabel;
Label2: TLabel;
procedure SpeedButton1Click(Sender: TObject);
private
procedure a(per: pointer);
procedure b(per: pointer);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
i,ii:integer;
hthreada,hthreadb:integer;
ThreadID1,ThreadID2:cardinal;
implementation
{$R *.dfm}
procedure tform1.a(per:pointer);
begin
repeat
label1.Caption :=inttostr(i);
i:=i+1;
until i>1000
end;
procedure tform1.b(per:pointer);
begin
repeat
Label2.caption:=inttostr(ii);
ii:=ii+1;
until ii>1000
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
hthreada,hthreadb:thandle;
ThreadID1,ThreadID2:dword;
begin
hthreada:=begin
Thread(nil,0,@a,nil,0,ThreadID1);
hthreadb:=begin
Thread(nil,0,@b,nil,0,ThreadID2);
end ;
end.