Filelistbox에 특정디렉토리의 화일들을 보여주고, 그 화일리스트를 하나의 스트링으로 만들어서 데이타를 보내주는 예제입니다. 그런데 화일리스트를 이용하지 않고, 이 기능을 구현하고 싶은데요.. 파일리스트의 속성? 을 상속해서 사용하면 될것같은데.
상속을 어떻게 하는지 잘모르겠습니다.
아래예제를 보시고 방법좀 가르쳐주시면 고맙겠습니다. 그럼 즐~~프하세요..
procedure FileListSend(fname:string);
var
F: File;
i: Integer;
stream:string;
totstream:string;
SourceHand:INTEGER;
begin
filelistBox1.Directory:=extractfilepath(fname);
for i := 0 to (FileListBox1.Items.Count - 1) do begin
try
if not FileExists(FileListBox1.Items.Strings[i]) then begin
MessageDlg('File: ' + FileListBox1.Items.Strings[i] +
' not found', mtError, [mbOk], 0);
Continue;
end;
AssignFile(F, FileListBox1.Items.Strings[i]);
Downloadfile:=fileOpen(fileListBox1.Directory+''+chatform.FileListBox1.Items.Strings[i],fmOpenread or fmShareDenyNone);
if Downloadfile=-1 then exit;
FileSeek(Downloadfile,0,0);
FileListBox1.Directory+''+FileListBox1.Items.Strings[i]));
stream:='#'+ filelistbox1.Items.Strings[i]+ '#',
if i = filelistbox1.items.count - 1 then begin
totstream:=totstream+stream+'#';
end
else
totstream:=totstream+stream;
finally
{ do something here }
CloseFile(F);
end;
end;
totstream:=copy(totstream,2,length(totstream));
SendData(chatform.ServerSocket.Socket.Connections[0], totstream,mtDIRECTORY);
end;