用API判断文件是否存在<br>function FileExistsAPI(const FileName:string):boolean;<br>var hf:hFile; <br>begin<br> hf:=CreateFile(PChar(FileName),GENERIC_READ,FILE_SHARE_READor FILE_SHARE_WRITE,nil,OPEN_EXISTING,0,0);<br> Result:=not(hf=INVALID_HANDLE_VALUE);<br> if Result then Result:=GetLastError=0 else CloseHandle(hf);<br>end;