R
RollingStone
Unregistered / Unconfirmed
GUEST, unregistred user!
各位辛苦,我的线程单元代码如下:
unit Unit1;
interface
uses
Classes, StdCtrls, SConnect;
type
TMyThread1 = class(TThread)
private
{ Private declarations }
FNo: Integer;
FStr: String;
FILow, FIHigh, MyI: Integer;
protected
procedure sckOpen;
procedure Execute;
override;
public
constructor Create(No: Integer;
str: String;
ILow, IHigh: Integer);
end;
implementation
{ Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TMyThead1.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end;
}
{ TMyThead1 }
uses SysUtils, Scan;
constructor TMyThread1.Create(No: Integer;
str: String;
ILow, IHigh: Integer);
begin
Self.FNo:= No;
Self.FStr:= str;
Self.FILow:= ILow;
Self.FIHigh:= IHigh;
Inherited Create(False);
end;
........
我的主程序中调用线程的过程如下:
....
procedure TMainForm.Button1Click(Sender: TObject);
begin
MyThread1.Create(1, edtStartIP.Text+'.'+ edt1.Text+ '.', 1, 63);
MyThread1.Create(2, edtStartIP.Text+'.'+ edt1.Text+ '.', 64, 127);
end;
.......
我使用的是delphi7,程序的意思是对***.***.***.1----***.***.***.127的地址段进行扫描,通过TSocketConnection进行扫描。
unit Unit1;
interface
uses
Classes, StdCtrls, SConnect;
type
TMyThread1 = class(TThread)
private
{ Private declarations }
FNo: Integer;
FStr: String;
FILow, FIHigh, MyI: Integer;
protected
procedure sckOpen;
procedure Execute;
override;
public
constructor Create(No: Integer;
str: String;
ILow, IHigh: Integer);
end;
implementation
{ Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TMyThead1.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end;
}
{ TMyThead1 }
uses SysUtils, Scan;
constructor TMyThread1.Create(No: Integer;
str: String;
ILow, IHigh: Integer);
begin
Self.FNo:= No;
Self.FStr:= str;
Self.FILow:= ILow;
Self.FIHigh:= IHigh;
Inherited Create(False);
end;
........
我的主程序中调用线程的过程如下:
....
procedure TMainForm.Button1Click(Sender: TObject);
begin
MyThread1.Create(1, edtStartIP.Text+'.'+ edt1.Text+ '.', 1, 63);
MyThread1.Create(2, edtStartIP.Text+'.'+ edt1.Text+ '.', 64, 127);
end;
.......
我使用的是delphi7,程序的意思是对***.***.***.1----***.***.***.127的地址段进行扫描,通过TSocketConnection进行扫描。