NMFTP-連按2次button會有錯誤發生 |
尚未結案
|
lydiae36
一般會員 發表:1 回覆:0 積分:0 註冊:2005-09-15 發送簡訊給我 |
我是個新手.... 先查看是否有目錄edit1.text名稱
再進入edit1.text目錄裡查看是否有檔案
如果有就button.enabled=true
按button後就可以開啟檔案 慢慢按都沒問題
但是!!我如果快速按speedbutton1兩下的話,會發生此錯誤
Debugger Exception Notification
project Cqr_eis.exe raised exception class EAcessViolation with message 'Assess violation at address 004A9748 in module 'Cqr_eis.exe'.Read of address 0000001C'.Process stopped.Use Step or Run to continue.
錯誤的地方機乎都會會停在
nmftp1.nlist上面 procedure Tfmdetail.SpeedButton1Click(Sender: TObject);
begin
NMFTP1.Host := 'xxxxxxxx';
NMFTP1.Port := 21;
NMFTP1.TimeOut :=20000;
NMFTP1.UserID := 'user';
NMFTP1.Password := '12345';
nmftp1.changedir('/CQR/');
list1:=False; //預設為false;
b1:=False; //button是否要顯示,無檔案則為不顯示false
b2:=False;
b3:=False;
b4:=False;
code:=1;
NMFTP1.nlist; 執行在listing裡為1的那一段,得知是否有目錄
if code=2 then begin
// code:=2; //button1
nmftp1.nlist; 得知是否有檔案
end
else
begin
button1.enabled:=false;
button2.enabled:=false;
button3.enabled:=false;
button4.enabled:=false;
end;
end; procedure Tfmdetail.NMFTP1ListItem(Listing: String);
begin
if code=1 then begin
if MatchesMask(listing,trim(edit1.text))=true then begin
list1:=true;
code:=2;
nmftp1.changedir('/CQR/'+trim(edit1.text)); //查看是否有此目錄存在
end;
end;
if code=2 then begin
if MatchesMask(listing,trim(edit1.text)+'CMP.*')=true then //找出是否有檔名存在
b1:=true;
if MatchesMask(listing,trim(edit1.text)+'OTH.*')=true then
b2:=true;
if MatchesMask(listing,qcno+'.*')=true then
b3:=true;
if MatchesMask(listing,qcno+'OTH.*')=true then
b4:=true;
if b1=false then
button1.enabled:=false
else
button1.enabled:=true;
if b2=false then
button2.enabled:=false
else
button2.enabled:=true;
if b3=false then
button3.enabled:=false
else
button3.enabled:=true;
if b4=false then
button4.enabled:=false
else
button4.enabled:=true
end; if code=11 then begin
if MatchesMask(listing,trim(edit1.text)+'CMP.*')=true then begin
fmie := Tfmie.create(self); //存在則開啟
uinternet.filepath:='ftp://xxxxxx'+trim(edit1.text)+'/'+listing;
fmie.ShowModal;
fmie.free;
end;
end;
if code=12 then begin
if MatchesMask(listing,trim(edit1.text)+'OTH.*')=true then begin
fmie := Tfmie.create(self);
uinternet.filepath:='ftp://xxxxxxxx'+trim(edit1.text)+'/'+listing;
fmie.ShowModal;
fmie.free;
end;
end;
if code=13 then begin
if MatchesMask(listing,qcno+'.*')=true then begin
fmie := Tfmie.create(self);
uinternet.filepath:='ftp://xxxxxxxxx'+trim(edit1.text)+'/'+listing;
fmie.ShowModal;
fmie.free;
end;
end;
if code=14 then begin
if MatchesMask(listing,qcno+'OTH.*')=true then begin
fmie := Tfmie.create(self);
uinternet.filepath:='ftp://xxxxxxx'+trim(edit1.text)+'/'+listing;
fmie.ShowModal;
fmie.free;
end;
end
|
Ktop_Robot
站務副站長 發表:0 回覆:3511 積分:0 註冊:2007-04-17 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |