D
dedragon
Unregistered / Unconfirmed
GUEST, unregistred user!
其实我已经知道代码了,但奇怪同一个程序,其他人可以正常运行,而我编译时提示delphi invalid argument to date encode这个错误呢?
代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,IdHTTP;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function GetURLFile(strURL, strFileName: string): boolean;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Msg: TMsg;
SL: TStringList;
I: Integer;
begin
GetURLFile('http://passport.csdn.net/ShowExPwd.aspx?DateTime=2006-05-19%2023:08:38&strimg=0.8544980050337276', 'E:/a.jpg');
end;
function TForm1.GetURLFile(strURL, strFileName: string): boolean;
var
ms:TMemoryStream;
idhttp: Tidhttp;
begin
ms:=TMemoryStream.Create;
Result:=true;
idhttp := TIdHTTP.Create(nil);
try
idhttp.Get(strURL,ms);
ms.Position:=0;
ms.SaveToFile(strFileName);
except
Result:=false;
end;
ms.Free;
end;
end.
~~~~~~~~~~
希望各位大侠多多帮忙
代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,IdHTTP;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function GetURLFile(strURL, strFileName: string): boolean;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Msg: TMsg;
SL: TStringList;
I: Integer;
begin
GetURLFile('http://passport.csdn.net/ShowExPwd.aspx?DateTime=2006-05-19%2023:08:38&strimg=0.8544980050337276', 'E:/a.jpg');
end;
function TForm1.GetURLFile(strURL, strFileName: string): boolean;
var
ms:TMemoryStream;
idhttp: Tidhttp;
begin
ms:=TMemoryStream.Create;
Result:=true;
idhttp := TIdHTTP.Create(nil);
try
idhttp.Get(strURL,ms);
ms.Position:=0;
ms.SaveToFile(strFileName);
except
Result:=false;
end;
ms.Free;
end;
end.
~~~~~~~~~~
希望各位大侠多多帮忙