P
PROSE
Unregistered / Unconfirmed
GUEST, unregistred user!
type 部分
TMMThread =class(TThread)
tthreadid:integer;
tthreadtype:integer;
urlStr :String;
ttpostdata :TStrings;
ttresponses : TStringStream;
constructor Create(ttid:integer;typeflag:integer;url:String;postdate:TStrings;responses : TStringStream);
procedure Execute;
override;
end;
{ TMMThread }
constructor TMMThread.create(ttid:integer;typeflag:integer;url:String;postdate:TStrings;responses : TStringStream);
begin
inherited Create(True);
FreeOnTerminate:=True;
Suspended:=false;
tthreadid:=ttid;
tthreadtype:=typeflag;
urlStr :=url;
ttpostdata :=postdate;
ttresponses := responses;
end;
procedure TMMThread.Execute;
var
thIdHTTP: TIdHTTP;
begin
try
thIdHTTP := TIdHTTP.Create(nil);
if tthreadtype =1 then
begin
thIdHTTP.HandleRedirects := True;
thIdHTTP.Request.ContentType := 'application/x-www-form-urlencoded' ;
thIdHTTP.Post(urlStr,ttpostdata,ttresponses);
end
else
if tthreadtype =2 then
begin
thIdHTTP.get(urlStr,ttresponses);
end;
finally
thIdHTTP.free;
end;
end;
var
Responses : TStringStream ;
PostData: TStrings;
surl,tt :string;
addThread :TMMThread;
调用部分
surl := 'http://'+serverurl+'/game/reg/login2.php';
addThread:=TMMThread.Create(1,1,surl,PostData, Responses);
可是
thIdHTTP.Post(urlStr,ttpostdata,ttresponses);
执行异常!!
哪位高手帮忙看看啊
TMMThread =class(TThread)
tthreadid:integer;
tthreadtype:integer;
urlStr :String;
ttpostdata :TStrings;
ttresponses : TStringStream;
constructor Create(ttid:integer;typeflag:integer;url:String;postdate:TStrings;responses : TStringStream);
procedure Execute;
override;
end;
{ TMMThread }
constructor TMMThread.create(ttid:integer;typeflag:integer;url:String;postdate:TStrings;responses : TStringStream);
begin
inherited Create(True);
FreeOnTerminate:=True;
Suspended:=false;
tthreadid:=ttid;
tthreadtype:=typeflag;
urlStr :=url;
ttpostdata :=postdate;
ttresponses := responses;
end;
procedure TMMThread.Execute;
var
thIdHTTP: TIdHTTP;
begin
try
thIdHTTP := TIdHTTP.Create(nil);
if tthreadtype =1 then
begin
thIdHTTP.HandleRedirects := True;
thIdHTTP.Request.ContentType := 'application/x-www-form-urlencoded' ;
thIdHTTP.Post(urlStr,ttpostdata,ttresponses);
end
else
if tthreadtype =2 then
begin
thIdHTTP.get(urlStr,ttresponses);
end;
finally
thIdHTTP.free;
end;
end;
var
Responses : TStringStream ;
PostData: TStrings;
surl,tt :string;
addThread :TMMThread;
调用部分
surl := 'http://'+serverurl+'/game/reg/login2.php';
addThread:=TMMThread.Create(1,1,surl,PostData, Responses);
可是
thIdHTTP.Post(urlStr,ttpostdata,ttresponses);
执行异常!!
哪位高手帮忙看看啊