多线程问题 高手请进!!!!
unit Unit2;
interface
uses
Classes,unit1;
type
lthread = class(TThread)
protected
procedure execute; override;
end;
implementation
procedure lthread.execute;
var
name:String;
password:string;
GetURL :String;
PostURL :String;
GetHtml :String;
sParams :String;
aParams :TStrings;
aStream :TStringStream;
begin
IdHTTP1 := TIdHTTP.Create(nil); //编译时这条代码提示出错 怎么修改 谢谢!
aParams := TStringList.Create;
aStream := TStringStream.Create('');
form1.memo1.Lines.Clear ;
name:=form1.edit1.Text ;
password:=form1.edit2.Text ;
GetURL := 'http://localhost/getinfo.asp'; {登录页面网址}
PostURL := 'http://localhost/getinfo.asp?password='+password; {提交网址}
sParams := 'name='+name; {提交参数}
try
aParams.Clear;
aParams.Add(sParams);
GetHtml := form1.IdHTTP1.Get(GetURL); {取登录页面}
form1.IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
form1.IdHTTP1.Post(PostURL, aParams, aStream); {提交}
form1.memo1.lines.Add(aStream.DataString);
form1.memo1.SelectAll ;
finally
form1.IdHTTP1.Free;
aParams.Free;
aStream.Free;
end;
end;
end.