type
TSyncGetFileFrom = Class
private
fUser,
fIP,
fDMIN,
fDescription,
fFileSize: String;
fFiles: TStringList;
protected
{}
public
Constructor Create; override;
Destructor Destroy; override;
property User : String read fUser write fUser;
property
IP : String read fIP write fIP;
property DMin : String read fDMin write fDMin;
property Description : String read fDescription write fDescription;
property FileSize : String read fFileSize write fFileSize;
property Files : TStringList read fFiles write fFiles;
// call showForm with syncronize from a Thread
procedure showForm;
end;
implementation
// uses
Unit wo TfrmGetFile definiert ist
{ TSyncGetFileFrom }
constructor TSyncGetFileFrom.Create;
begin
inherited;
fFiles := TSTringList.Create;
end;
destructor TSyncGetFileFrom.Destroy;
begin
FreeAndNil(fFiles);
inherited;
end;
// look is extactly your code, but knoe syncronized
procedure TSyncGetFileFrom.showForm;
begin
If Application.FindComponent('GF' + DMIN) = Nil Then
begin
Application.CreateForm(TfrmGetFile, TfGF);
TfGF.Name:='GF' + DMIN;
TfGF.lblUserName.Caption := User;
TfGF.TCP.Host :=
IP;
TfGF.SetStatus('Online');
TfGF.lstboxFiles.Items.Assign(Files);
TfGF.memDescription.Text:=Description;
TfGF.lblFileSize.Caption:=FileSize;
end
else
begin
TfGF:=(Application.FindComponent('GF' + DMIN) As TfrmGetFile);
TfGF.TCP.Host :=
IP;
TfGF.SetStatus('Online');
TfGF.lstboxFiles.Items.Assign(Files);
TfGF.memDescription.Text:=Description;
TfGF.lblFileSize.Caption:=FileSize;
TfGF.SetFocus;
end;
end;
// So und im OnExecute des Server rufst Du jetzt folgendes auf :
Var mySyncForm : TSyncGetFileForm;
begin
// ... Code
mySyncForm := TSyncGetFileForm.Create;
mySyncForm.User := User;
mySyncForm.IP :=
IP;
mySyncForm.DMin := DMin;
mySyncForm.DEscription := Description;
mySyncForm.FileSize := SizeOfFiles;
mySyncForm.Files.assign(Files);
// use syncronize now
aThread.syncronize(mySyncForm.showForm);
// That's it
end;