【收集人:张子萌 】
1. Form1中调用Form2窗口
Form2.ShowModal; //显示form2窗口
Form2.close; //关闭窗口
2. 获取title,可查看UTF-8编码
procedure TForm2.Button1Click(Sender: TObject); //获取title
var
webboby:string;
r:TRegExpr;
s1:string;
charseti:integer;
gethttp:Tidhttp;
begin
gethttp:=Tidhttp.Create(self);
webboby:=gethttp.Get(Edit1.Text);
charseti:=pos(‘charset=’,webboby);
if (copy(webboby,charseti+8,3)=’utf’) or (copy(webboby,charseti+8,3)=’UTF’) then
webboby:=UTF8Decode(webboby);
s1:=”;
r:= TRegExpr.Create;
try // ensure memory clean-up
r.Expr
if r.Exec(webboby) then
REPEAT
s1 :=r.Match [0];
Edit2.Text:=s1;
UNTIL not
r.ExecNext;
finally
r.Free;
end;
end;
发表评论