cibersoft Posted August 21, 2006 at 03:18 PM Report Share #45600 Posted August 21, 2006 at 03:18 PM Boa Tarde, gostaria de saber se posivel como faço para fazer um programa que me permita fazer downloads da internet de uma certa URL. Obrigado. ? Link to comment Share on other sites More sharing options...
M6 Posted August 21, 2006 at 03:42 PM Report Share #45603 Posted August 21, 2006 at 03:42 PM Dependendo da versão do Delphi que possuis, e dos componentes que tens à tua disposição, podes usar um componente de cliente de http e/ou ftp para isso. Consulta a documentação e vê os tutoriais que acompanham o Delphi. 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar." Link to comment Share on other sites More sharing options...
cibersoft Posted August 21, 2006 at 10:23 PM Author Report Share #45734 Posted August 21, 2006 at 10:23 PM Eu tenho a versão home edition que eles deixam fazer download gratuitamente, portanto uma versão limitada. A versão que eu tenho é o Delphi 7.0. Obrigado. 😁 Link to comment Share on other sites More sharing options...
M6 Posted August 22, 2006 at 09:37 AM Report Share #45868 Posted August 22, 2006 at 09:37 AM Há imensos componentes VCL por ai, "google it". 🙂 De certo vais encontrar alguns que até já fazem o que pretendes. No limite podes sempre usar o OCX do IE embebido numa aplicação tua. 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar." Link to comment Share on other sites More sharing options...
knightcoder Posted August 22, 2006 at 02:26 PM Report Share #45925 Posted August 22, 2006 at 02:26 PM Aqui está um exemplo: uses WinInet; function GetInetFile (const fileURL, FileName: 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(fileURL), nil,0,0,0); try AssignFile(f, FileName); 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; procedure TForm1.Button1Click(Sender: TObject); var InternetFile,LocalFile: string; begin InternetFile:='http://www.delphitips.com/images/delphispirit.gif'; LocalFile:='c:/delphispirit.gif'; if GetInetFile(InternetFile,LocalFile)=True then ShowMessage('download') else ShowMessage('Can not download the updated files'); end; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now