以下例子成功登录本BBS后打勾,不成功或登录到其它网站不打勾。
uses ...,MsHtml;
procedure TForm1.Button3Click(Sender: TObject);
begin
webbrowser1.Navigate ('http://www.delphibbs.com');
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
webbrowser1.Navigate ('http://www.china.com');
end;
procedure TForm1.WebBrowser1NavigateComplete2(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
s,MyUrl:string;
begin
MyUrl:=uppercase('http://www.delphibbs.com');
s:=uppercase((webbrowser1.Document as IHTMLDocument2).url);
s:=copy(s,1,length(MyUrl));
checkbox1.Checked:=(s=MyUrl);
end;