用于获取备忘录中页面源代码的组件或代码。 谢谢
答案 0 :(得分:2)
//It works on Win32/Win64/OS X !
procedure TMainForm.Button_DownloadClick(Sender: TObject);
const
URL = 'http://web.t-online.hu/karpo/downloads/3dc32480.zip';
var
fsSource: TFileStream;
FILENAME_Local: String;
begin
{$IFDEF MSWINDOWS}
FILENAME_Local:=ExtractFilePath(ParamStr(0))+'proba.zip';
{$ENDIF}
{$IFDEF MACOS} //OS X user !
FILENAME_Local:='/users/zoltankarpati/public/proba.zip';
{$ENDIF}
if FileExists(FILENAME_Local) then
begin
fsSource := TFileStream.Create(FILENAME_Local, fmOpenWrite);
end
else
begin
fsSource := TFileStream.Create(FILENAME_Local, fmCreate);
end;
try
IdHTTP.Get(URL, fsSource);
finally
fsSource.Free;
end;
end;