procedure TForm1.Button1Click(Sender: TObject);
bDelete : boolean;
i : integer;
filename : string;
begin
filename := 'C:\1.txt';
if(not SetFileAttributes(PChar(filename), FILE_ATTRIBUTE_NORMAL)) then
begin
showmessage('file attribute to normal error !');
end;
i:=0;
bDelete:=DeleteFile(filename);
//刪5次試試
while((i<5) and (not bDelete)) do
begin
Sleep(1000);
bDelete:=DeleteFile(PChar(filename));
Inc(i);
end;
end;
星期五, 10月 12, 2007
正確的刪除檔案步驟
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言