delphi7的代码用XE8编译成功,但是功能不能用,是什么情况?

编译成EXE 提示注册失败 登陆失败 大神帮忙看看什么问题????
unit Unit1;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms,
Vcl.Dialogs, Vcl.StdCtrls, System.Math, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP, System.DateUtils, Vcl.ExtCtrls, Unit4, Vcl.ComCtrls;

type
TForm1 = class(TForm)
account: TEdit;
password: TEdit;
Button2: TButton;
IdHTTP1: TIdHTTP;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button5: TButton;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Button6: TButton;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Button7: TButton;
Button1: TButton;
Button3: TButton;
Button4: TButton;
Button8: TButton;
Label1: TLabel;

procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
Fuwuqi: String;
zhanghao : String;
mima : String;
Duqu1: String;
Duqu2: String;
Suiji: String;

implementation

{$R *.dfm}
uses MD5;
//HDDSerial, CPUInfo //需要限制机器码 在添加
procedure TForm1.FormCreate(Sender: TObject);
begin
Fuwuqi:='http://127.0.0.1/' ;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
Dizhi:string;
shijian :string;
Duqu:string;
begin
IdHttp1.HandleRedirects := true;
randomize;//
Suiji:=StrToMD5(inttostr(randomrange(1000000,9999999)));
Dizhi:=idhttp1.Get(fuwuqi+'time.asp?random='+Suiji) ;
shijian:=IntToStr(YearOf(StrToDateTime(Dizhi)))+IntToStr(MonthOf(StrToDateTime(Dizhi)))+
IntToStr(DAYOf(StrToDateTime(Dizhi)))+IntToStr(HourOf(StrToDateTime(Dizhi)))+
IntToStr(MinuteOf(StrToDateTime(Dizhi)));//
randomize;//
Suiji:=StrToMD5(inttostr(randomrange(1000000,9999999)));
Duqu:=idhttp1.Get(Fuwuqi+'api.asp?online=0&user='+account.text+'&pass=' +StrToMD5(StrToMD5(password.Text)+shijian)
+'&chkcode='+Suiji);
Duqu1:=copy(Duqu,1,32);
Duqu2:=copy(Duqu,34,10);
if Duqu='err:key' then Showmessage('帐号或密码错误') else
if Duqu='err:time' then Showmessage('帐号已过期') else
if Duqu='err:lock' then Showmessage('帐号异常') else
if Duqu1= StrToMD5(Suiji+','+Duqu2+','+shijian) then
begin
Form1.Free;
//Application.Terminate;
//zhanghao:=account.Text;
//mima:=password.text;
form4.Timer1.Enabled:=true;
form4.ShowModal;
end
else
Showmessage('失败')
end;

end.

XE8是Unicode编码,要么就把你的代码String全部改成AnsiString;要么就把你加密的从新写.追问

具体怎么做呢

追答

变量和参数都改成AnsiString不会? 直接改就完了呗。

追问

不是不会,是没听懂,不好意思:
如:Dizhi:string; 改成Dizhi:AnsiString

追答

就是这样改,改完以后可能会有不兼容,注意看错误提示和警告,大部分警告可以不用管。
比如 suiji:AnsiString; 你用 Edit1.Text := suiji;就会出现警告,这些是可以忽略的。
特别是加密的函数参数一定要改;看你的代码 原版应该是 function StrToMD5(const Str:String):String; 改成 function StrToMD5(const Str:AnsiString):AnsiString;
如果内部还有其他的函数过程也全部改.

温馨提示:内容为网友见解,仅供参考
无其他回答

Warning: Invalid argument supplied for foreach() in /www/wwwroot/aolonic.com/skin/templets/default/contents.html on line 45
相似回答