上传单元 (100分)

  • 主题发起人 主题发起人 zhoujian010
  • 开始时间 开始时间
Z

zhoujian010

Unregistered / Unconfirmed
GUEST, unregistred user!
哪位高手看看下面的代码,错在哪里,为什么这个上传单元会出错?
unit UpLoadUnit;

interface

uses
Classes, IdTCPServer,IdGlobal,ComCtrls,SysUtils;

type
TUpLoadThread = class(TThread)
private
TheFileName:String;
TheFileSize:integer;
SysThread:TIdPeerThread;
protected
procedure Execute; override;
Public
constructor Create(AThread:TIdPeerThread;TFN:String;TheLen:integer);
destructor Destroy; override;
end;

implementation
uses APFUnit,server;

constructor TUpLoadThread.Create(AThread:TIdPeerThread;TFN:String;TheLen:integer);
begin
inherited Create(true);
TheFileName:=TFN;
TheFileSize:=TheLen;
SysThread:=AThread;
FreeOnTerminate:=true;
Suspended := false;
Priority:=tpIDLE;
end;

procedure TUpLoadThread.Execute;
var
SaveFStream:TFileStream;
begin
try
SaveFStream:=TFileStream.Create(TheFileName,fmCreate);
except
SysThread.Terminate;
self.Terminate;
exit;
end;
SaveFStream.Size:=0;
try
SysThread.Connection.ReadStream(SaveFStream,TheFileSize);//好像经常这儿出错,不知道如何改
except
SaveFStream.Free;
SysThread.Terminate;
self.Terminate;
exit;
end;
end;

destructor TUpLoadThread.Destroy;
begin
inherited destroy;
end;
end.
 
什么错提示
 
Connection好像没有此方法吧
 
出现的错误提示是:
存取地址00460FB4违例发生在模块'MM.EXE'中,读在地址00000000里。
其中MM.EXE是程序名称。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部