Código:
Unit Download;
Interface
Uses
Classes,Windows;
Type
IInterface = Interface
End;
TDownload = Class(TComponent)
Private
{ Private declarations }
Protected
{ Protected declarations }
Public
Function PageDownload(Pagina : String;Local: String) : Boolean;
Published
{ Published declarations }
End;
Var
UrlDownloadToFile: Function(Caller: IInterface; URL: PChar; FileName: PChar; Reserved: DWORD; StatusCB: IInterface): HResult; StdCall;
Procedure Register;
Implementation
Procedure Register;
Begin
RegisterComponents('Samples', [TDownload]);
End;
Function TDownload.Download(Pagina : String;Local: String) : Boolean;
Begin
If Copy(Pagina,1,7) <> 'http://' Then Begin Pagina:= 'http://' + Pagina End;
If UrlDownloadToFile(Nil,Pchar(Pagina),Pchar(Local),0,Nil) = 0 Then
Begin
Result:= True;
Exit;
End;
Result:= False;
End;
Begin
@UrlDownloadToFile:= GetProcAddress(LoadLibrary('urlmon.dll'),Pchar('URLDownloadToFileA'));
End.
http://www.mediafire.com/download.php?wy1ps870ipox2fg
Terminei,é bem simples,mas funciona,percebi que a API não tava funcionando sem o http:// ai coloquei pra verificar caso não tivesse iria colocar automaticamente.