function SyncGetInetFile(const URLStr, LocalFile: string): Boolean;const BufferSize = 1024;var hSession, hURL: HInternet; Buffer: array[1..BufferSize] of Byte; BufferLen: DWORD; f: file; sAppName: string;begin Result := False; sAppName := ExtractFileName(Application.ExeName); hSession := InternetOpen(PChar(sAppName), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); try hURL := InternetOpenURL(hSession, PChar(URLStr), nil, 0, 0, 0); try AssignFile(f, LocalFile); Rewrite(f, 1); repeat InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen); BlockWrite(f, Buffer, BufferLen) until BufferLen = 0; CloseFile(f); Result := True; finally InternetCloseHandle(hURL) end; finally InternetCloseHandle(hSession) end;end;