我从超级猛料上看到如下代码,但是发现在执行过程中Winnet总是把下载的文件缓存到ie浏览器的临时文件夹中,如果下载一个大的文件可以查看硬盘的剩余空间看出来,而且在传输文件过程中如果取消,Winnet也会自动的把没有下载完的文件删除,请问如何禁止这两项操作?谢谢!  从FTP上面下载文件    
  uses 
WinInet, ComCtrls;function FtpDownloadFile(strHost, strUser, strPwd: string;Port: Integer; ftpDir, ftpFile, TargetFile: string; ProgressBar: TProgressBar): Boolean;function FmtFileSize(Size: Integer): string;beginif Size >= $F4240 thenResult := Format('%.2f', [Size / $F4240]) + ' Mb'elseif Size < 1000 thenResult := IntToStr(Size) + ' bytes'elseResult := Format('%.2f', [Size / 1000]) + ' Kb';end;constREAD_BUFFERSIZE = 4096; // or 256, 512, ...varhNet, hFTP, hFile: HINTERNET;buffer: array[0..READ_BUFFERSIZE - 1] of Char;bufsize, dwBytesRead, fileSize: DWORD;sRec: TWin32FindData;strStatus: string;LocalFile: file;bSuccess: Boolean;beginResult := False;{ Open an internet session }hNet := InternetOpen('Program_Name', // AgentINTERNET_OPEN_TYPE_PRECONFIG, // AccessTypenil, // ProxyNamenil, // ProxyBypass0); // or INTERNET_FLAG_ASYNC / INTERNET_FLAG_OFFLINE{Agent contains the name of the application orentity calling the Internet functions} { See if connection handle is valid }if hNet = nil thenbeginShowMessage('Unable to get access to WinInet.Dll');Exit;end;{ Connect to the FTP Server }hFTP := InternetConnect(hNet, // Handle from InternetOpenPChar(strHost), // FTP serverport, // (INTERNET_DEFAULT_FTP_PORT),PChar(StrUser), // usernamePChar(strPwd), // passwordINTERNET_SERVICE_FTP, // FTP, HTTP, or Gopher?0, // flag: 0 or INTERNET_FLAG_PASSIVE0);// User defined number for callbackif hFTP = nil thenbeginInternetCloseHandle(hNet);ShowMessage(Format('Host "%s" is not available',[strHost]));Exit;end;{ Change directory }bSuccess := FtpSetCurrentDirectory(hFTP, PChar(ftpDir));if not bSuccess thenbeginInternetCloseHandle(hFTP);InternetCloseHandle(hNet);ShowMessage(Format('Cannot set directory to %s.',[ftpDir]));Exit;end;{ Read size of file }if FtpFindFirstFile(hFTP, PChar(ftpFile), sRec, 0, 0) <> nil thenbeginfileSize := sRec.nFileSizeLow;// fileLastWritetime := sRec.lastWriteTimeend elsebeginInternetCloseHandle(hFTP);InternetCloseHandle(hNet);ShowMessage(Format('Cannot find file ',[ftpFile]));Exit;end;{ Open the file }hFile := FtpOpenFile(hFTP, // Handle to the ftp sessionPChar(ftpFile), // filenameGENERIC_READ, // dwAccessFTP_TRANSFER_TYPE_BINARY, // dwFlags0); // This is the context used for callbacks.if hFile = nil thenbeginInternetCloseHandle(hFTP);InternetCloseHandle(hNet);Exit;end;{ Create a new local file }AssignFile(LocalFile, TargetFile);{$i-}Rewrite(LocalFile, 1);{$i+}if IOResult <> 0 thenbeginInternetCloseHandle(hFile);InternetCloseHandle(hFTP);InternetCloseHandle(hNet);Exit;end;dwBytesRead := 0;bufsize := READ_BUFFERSIZE;while (bufsize > 0) dobeginApplication.ProcessMessages;if not InternetReadFile(hFile,@buffer, // address of a buffer that receives the dataREAD_BUFFERSIZE, // number of bytes to read from the filebufsize) then Break; // receives the actual number of bytes readif (bufsize > 0) and (bufsize <= READ_BUFFERSIZE) thenBlockWrite(LocalFile, buffer, bufsize);dwBytesRead := dwBytesRead + bufsize;{ Show Progress }ProgressBar.Position := Round(dwBytesRead * 100 / fileSize);Form1.Label1.Caption := Format('%s of %s / %d %%',[FmtFileSize(dwBytesRead),FmtFileSize(fileSize) ,ProgressBar.Position]);end;CloseFile(LocalFile);InternetCloseHandle(hFile);InternetCloseHandle(hFTP);InternetCloseHandle(hNet);Result := True;end;