试试用下面的一种(Delhpi很久没动了,我都记不起那个才是正确的 :-) 可能是第一种,你查查关于forward的HELP )function DownloadFile(Source, Dest: string): Boolean;forward;orforward function DownloadFile(Source, Dest: string): Boolean;or
function DownloadFile(Source, Dest: string): Boolean:forward;
function DownloadFile(Source, Dest: string): Boolean:forward;
function TForm1.DownloadFile(Source, Dest: string): Boolean; //notice TForm1
begin
try
Result := UrlDownloadToFile(nil, PChar(source), PChar(Dest), 0, nil) = 0;
except
Result := False;
end;
end;
;
或:
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
// function DownloadFile(Source, Dest: string): Boolean;
end;
function DownloadFile(Source, Dest: string): Boolean;
begin
//
end;.......
function TForm1.DownloadFile(Source, Dest: string): Boolean;
begin
..............................
..............................
end;
建议在声明部分写好函数原形后,按shift+ctrl+c自动完成实现部分的部分代码!