在delphi中使用webbrowser发送一个连接,网站接收后返回一个状态码显示在webbrowser中,如何获取这个状态码?例如:发送连接:http://sms.api.bz/fetion.php?username=用户名&password=密码&sendto=用户&message=内容
然后如果用户名或者密码错误,网站就返回‘101’这个状态码
如何获取这个‘101’呢?
然后如果用户名或者密码错误,网站就返回‘101’这个状态码
如何获取这个‘101’呢?
解决方案 »
- uses里面的函数是什么意思?
- 如果判断一个FORM里面是否有某个控件
- 那位大虾给我写个小算法,100分献上,不够在给!~
- interbase的引擎是什么?
- “如果文件不存在则创建”用FileExists和tstringlist如何实现
- 在一个子窗口使用query查询,数据量大时主窗口停止响应,解决了有分。
- 关于屏幕滚动显示文字的问题?
- Pchar 怎么用?拿来做什么的?
- 如何使用worddocument组件,delphi没有帮助吗!?
- 收藏 不显示删除回复显示所有回复显示星级回复显示得分回复 求高手。。。。每次都运行不了,错误提示:Tchart类找不到,TApdComPort类找不到
- delphi部分语句不执行怎么解决
- 为何delphi 的父体窗上的图片无法继承
function GetHtml(const WebBrowser:TWebBrowser):string;
const
BufSize=$10000;
var
Size:Int64;
Stream:IStream;
hHTMLText:HGLOBAL;
psi:IPersistStreamInit;
begin
if not Assigned(WebBrowser.document) then Exit;
OleCheck(WebBrowser.Document.QueryInterface(IPersistStreamInit,psi));
try
hHTMLText:=GlobalAlloc(GPTR,BufSize);
OleCheck(CreateStreamOnHGlobal(hHTMLText,True,Stream));
try
OleCheck(psi.Save(Stream,False));
Size:=StrLen(PChar(hHTMLText));
SetLength(Result,Size);
CopyMemory(PChar(Result),Pointer(hHTMLText),Size);
finally
Stream:=nil;
end;
finally
psi:=nil;
end;end;procedure TForm1.wb1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
strcode:Word;
begin
strcode:=0;
if wb1.Application=pDisp then
strcode:=StrToInt(GetHtml(wb1)); case strcode of
100: mmo1.Text:='测试结果:发送成功';
101: mmo1.Text:='测试结果:验证失败';
102: mmo1.Text:='测试结果:短信不足';
103: mmo1.Text:='测试结果:操作失败';
104: mmo1.Text:='测试结果:非法字符';
105: mmo1.Text:='测试结果:内容过多';
106: mmo1.Text:='测试结果:号码过多';
107: mmo1.Text:='测试结果:频率过快';
108: mmo1.Text:='测试结果:号码内容空';
109: mmo1.Text:='测试结果:账号冻结';
110: mmo1.Text:='测试结果:禁止频繁单条发送';
111: mmo1.Text:='测试结果:系统暂定发送';
120: mmo1.Text:='测试结果:系统升级';
else
mmo1.Text:='测试结果:未知错误';
end;end;