procedure TShowForm.Timer3Timer(Sender: TObject);
var
TmpStr:string;
Sparams:TStringList;
Response: TStringStream;
str:string;
num:integer;
strnew:string;
resultstr:string;
webhttp:string;
s:string; strname:String;
strpassword:string;
begin
//这里是向服器发送请求
Response := TStringStream.Create('');
Sparams:=Tstringlist.Create;
webhttp := editweb.Text;
s :=Copy(webhttp,length(webhttp),1);
if s = '/' then
begin
tmpstr := webhttp + 'cs/SelectNum.aspx';
end
else
begin
tmpstr := webhttp + '/cs/SelectNum.aspx';
end; Sparams.Add('username='+Utf8Encode(editusername.Text));
idhttp1.Request.ContentType := 'application/x-www-form-urlencoded';
idhttp1.Request.ContentLength:=length(sparams.Text);
try
try
idhttp1.Post(tmpstr,sparams,Response);
if idhttp1.ResponseCode = 200 then
begin
str := Utf8ToAnsi(Response.DataString); //解决中文问题
end;
except
end;
finally
response.Free;
idhttp1.Disconnect;
end; if str<>editnum.Text then
begin
showform.Panel1.Visible := false;
showform.Button1.Caption := '您当前有' + str + '条未读信息';
editnum.Text := str;
showform.Show;
end
else
begin
Application.MessageBox('密码错误,请重新输入!!!','失败',MB_OK+MB_ICONINFORMATION);
end;
end;
var
TmpStr:string;
Sparams:TStringList;
Response: TStringStream;
str:string;
num:integer;
strnew:string;
resultstr:string;
webhttp:string;
s:string; strname:String;
strpassword:string;
begin
//这里是向服器发送请求
Response := TStringStream.Create('');
Sparams:=Tstringlist.Create;
webhttp := editweb.Text;
s :=Copy(webhttp,length(webhttp),1);
if s = '/' then
begin
tmpstr := webhttp + 'cs/SelectNum.aspx';
end
else
begin
tmpstr := webhttp + '/cs/SelectNum.aspx';
end; Sparams.Add('username='+Utf8Encode(editusername.Text));
idhttp1.Request.ContentType := 'application/x-www-form-urlencoded';
idhttp1.Request.ContentLength:=length(sparams.Text);
try
try
idhttp1.Post(tmpstr,sparams,Response);
if idhttp1.ResponseCode = 200 then
begin
str := Utf8ToAnsi(Response.DataString); //解决中文问题
end;
except
end;
finally
response.Free;
idhttp1.Disconnect;
end; if str<>editnum.Text then
begin
showform.Panel1.Visible := false;
showform.Button1.Caption := '您当前有' + str + '条未读信息';
editnum.Text := str;
showform.Show;
end
else
begin
Application.MessageBox('密码错误,请重新输入!!!','失败',MB_OK+MB_ICONINFORMATION);
end;
end;
解决方案 »
- 求一个API函数.已知进程ID,如何判断该进程是否存在
- 求SQL语句一个
- IdTcpServer/Client中,IdTcpServer.Threads是不是指连接到服务器的所以客户端?
- 求助关于自定义控件:(
- 大家帮帮忙
- 在fastRepor Memo中打印一字段的字符串,當字符串遇到分號自動換行該怎麼去實現啊!
- 在Delphi6中最好用什么数据控件访问SQL Sever2000?
- tquery 为什么在sql属性写入语句后,点击active为真时,为何出现错误提示?
- 如何在Delphi中实现删除IE地址栏中的地址!
- DELPHI 调用C DLL 问题,LPSTR* 什么替换类型,请高手指点。
- dll中如何控制主窗体状态呢?
- 大家看看 我这个多条件查询有没有错误!!!谢谢了大家!
Response := TStringStream.Create('');
Sparams:=Tstringlist.Create;
....
finally
Response.Free;
Sparams.Free;
end;
if editweb.Text[1] = '/' then
begin
tmpstr := editweb.Text + 'cs/SelectNum.aspx';
end
else
begin
tmpstr :=editweb.Text + '/cs/SelectNum.aspx';
end;