線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1737
推到 Plurk!
推到 Facebook!

indy的demo程式ftpdemo.dpr有一些問題,紅色部分即是問題所在

 
ry_lee
高階會員


發表:368
回覆:251
積分:123
註冊:2002-03-19

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-10-04 09:06:20 IP:218.163.xxx.xxx 未訂閱

procedure TMainForm.DirectoryListBoxDblClick(Sender: TObject);
Var
Name{, Line}: String;
begin
if not IdFTP1.Connected then exit;
//Line := DirectoryListBox.Items[DirectoryListBox.ItemIndex];
Name := IdFTP1.DirectoryListing.Items[DirectoryListBox.ItemIndex].Data;//.itemname
//上一行原本是Name := IdFTP1.DirectoryListing.Items[DirectoryListBox.ItemIndex].itemname
//但編譯時發生錯誤將後面得.itemname改為.data就可編譯,改這樣對嗎?
if IdFTP1.DirectoryListing.Items[DirectoryListBox.ItemIndex].ItemType=ditDirectory
//上一行原本是Name := IdFTP1.DirectoryListing.Items[DirectoryListBox.ItemIndex].isdirtectory
//但編譯時發生錯誤將後面得.isdirtectory改為.ItemType=ditDirectory就可編譯,改這樣對嗎?
then begin //isdirectory
// Change directory
SetFunctionButtons(false);
ChageDir(Name);
SetFunctionButtons(true);
end
else begin
try
SaveDialog1.FileName := Name;
if SaveDialog1.Execute then begin
SetFunctionButtons(false);

IdFTP1.TransferType := ftBinary;
BytesToTransfer := IdFTP1.Size(Name);

if FileExists(Name) then begin
case MessageDlg('File aready exists. Do you want to resume the download operation?',
mtConfirmation, mbYesNoCancel, 0) of
mrYes: begin
BytesToTransfer := BytesToTransfer - FileSizeByName(Name);
IdFTP1.Get(Name, SaveDialog1.FileName, false, true);
end;
mrNo: begin
IdFTP1.Get(Name, SaveDialog1.FileName, true);
end;
mrCancel: begin
exit;
end;
end;
end
else begin
IdFTP1.Get(Name, SaveDialog1.FileName, false);
end;
end;
finally
SetFunctionButtons(true);
end;
end;
end;
==========================================================================
procedure TMainForm.ChageDir(DirName: String);
Var
LS: TStringList;
begin
LS := TStringList.Create;
try
SetFunctionButtons(false);
IdFTP1.ChangeDir(DirName);
IdFTP1.TransferType := ftASCII;

CurrentDirEdit.Text := IdFTP1.RetrieveCurrentDir;

DirectoryListBox.Items.Clear;
IdFTP1.List(LS);
DirectoryListBox.Items.Assign(LS);
DirectoryListBox.Refresh;
//上一行是我加得,因為DirectoryListBox在顯示檔案目錄資訊時顯示得很模糊,但加DirectoryListBox.Refresh;
//似乎無作用,請問有什麼方法可改善DirectoryListBox在顯示檔案目錄資訊時顯示得很模糊的問題,
//DirectoryListBox在顯示檔案目錄資訊時,可否僅顯示檔名而不顯示檔案存取權限及大小?
if DirectoryListBox.Items.Count > 0 then
if AnsiPos('total', DirectoryListBox.Items[0]) > 0 then DirectoryListBox.Items.Delete(0);
finally
SetFunctionButtons(true);
LS.Free;
end;
end;

系統時間:2024-04-29 15:44:42
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!