K
kytcw
Unregistered / Unconfirmed
GUEST, unregistred user!
50分不够,我再加100分!急啊!请大家帮下忙
var
name:String;
password:string;
GetURL :String;
PostURL :String;
GetHtml :String;
sParams :String;
aParams :TStrings;
aStream :TStringStream;
begin
time := 0;
label8.Caption := '';
if edit1.Text = '' then
begin
label8.Visible := true;
label8.Caption := '请输入您的用户名!';
exit;//跳出
end;
if edit2.Text = '' then
begin
label8.Visible := true;
label8.Caption := '请输入您的登陆密码!';
exit;//跳出
end;
button1.Enabled := false;
timer1.Enabled := true;//打开时间控件记时,开始
edit1.Enabled := false;//禁用用户名输入框
edit2.Enabled := false;//禁用登陆密码输入框
check.Enabled := false;//禁用使用代理服务器选项
IdHTTP1 := TIdHTTP.Create(nil);
aParams := TStringList.Create;
aStream := TStringStream.Create('');
edit3.Text := '';
name:=edit1.Text ;
password:=edit2.Text ;
if check.Checked then
begin
idhttp1.ProxyParams.ProxyServer :=ip.Text ;
idhttp1.ProxyParams.ProxyPort :=StrToInt(port.text);
idhttp1.ProxyParams.ProxyUsername:=zh.Text ;
idhttp1.ProxyParams.ProxyPassword:=mm.Text ;
end
else
begin
idhttp1.ProxyParams.ProxyServer :='';
idhttp1.ProxyParams.ProxyPort :=0;
idhttp1.ProxyParams.ProxyUsername:='';
idhttp1.ProxyParams.ProxyPassword:='';
end;
try
aParams.Clear;
aParams.Add(sParams);
GetHtml := IdHTTP1.Get(GetURL);
{取登录页面}
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Post(PostURL, aParams, aStream);
{提交}
Edit3.Text := aStream.DataString;
finally
IdHTTP1.Free;
aParams.Free;
aStream.Free;
end;
为什么 IdHTTP1 := TIdHTTP.Create(nil);
这一段不能写入线程?写进去就出错.
还有这一段 idhttp1.ProxyParams.ProxyPort := StrToInt(port.text);也会出错!难道在线程序里不能用strtoint吗?
有那位高手告诉我一下用什么方法才行~或帮忙把上面代码改为可以正常执行的线程代码.谢谢了!在线等!!!!
var
name:String;
password:string;
GetURL :String;
PostURL :String;
GetHtml :String;
sParams :String;
aParams :TStrings;
aStream :TStringStream;
begin
time := 0;
label8.Caption := '';
if edit1.Text = '' then
begin
label8.Visible := true;
label8.Caption := '请输入您的用户名!';
exit;//跳出
end;
if edit2.Text = '' then
begin
label8.Visible := true;
label8.Caption := '请输入您的登陆密码!';
exit;//跳出
end;
button1.Enabled := false;
timer1.Enabled := true;//打开时间控件记时,开始
edit1.Enabled := false;//禁用用户名输入框
edit2.Enabled := false;//禁用登陆密码输入框
check.Enabled := false;//禁用使用代理服务器选项
IdHTTP1 := TIdHTTP.Create(nil);
aParams := TStringList.Create;
aStream := TStringStream.Create('');
edit3.Text := '';
name:=edit1.Text ;
password:=edit2.Text ;
if check.Checked then
begin
idhttp1.ProxyParams.ProxyServer :=ip.Text ;
idhttp1.ProxyParams.ProxyPort :=StrToInt(port.text);
idhttp1.ProxyParams.ProxyUsername:=zh.Text ;
idhttp1.ProxyParams.ProxyPassword:=mm.Text ;
end
else
begin
idhttp1.ProxyParams.ProxyServer :='';
idhttp1.ProxyParams.ProxyPort :=0;
idhttp1.ProxyParams.ProxyUsername:='';
idhttp1.ProxyParams.ProxyPassword:='';
end;
try
aParams.Clear;
aParams.Add(sParams);
GetHtml := IdHTTP1.Get(GetURL);
{取登录页面}
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Post(PostURL, aParams, aStream);
{提交}
Edit3.Text := aStream.DataString;
finally
IdHTTP1.Free;
aParams.Free;
aStream.Free;
end;
为什么 IdHTTP1 := TIdHTTP.Create(nil);
这一段不能写入线程?写进去就出错.
还有这一段 idhttp1.ProxyParams.ProxyPort := StrToInt(port.text);也会出错!难道在线程序里不能用strtoint吗?
有那位高手告诉我一下用什么方法才行~或帮忙把上面代码改为可以正常执行的线程代码.谢谢了!在线等!!!!