implementation
uses WinInet,mshtml, WinTypes,JpegErrors;
{$R *.dfm}
procedure TForm5.Button1Click(Sender: TObject);
begin
Webbrowser1.Navigate('
http://www.google.de');
end;
Procedure GetWebBrowserHREFList(
const AWebBrowser: TWebBrowser;List:TStrings) ;
var
nCount : Integer;
elements : IHTMLElementCollection;
element : IHTMLElement;
sAnchor :
String;
begin
if Assigned(AWebBrowser.Document)
then begin
elements:= (AWebBrowser.Document
as IHTMLDocument2).all;
for nCount := 0
To Pred(elements.Length)
do begin
element := elements.item(nCount, '
')
as IHTMLElement;
if element.tagName = '
A'
then begin
sAnchor := (element
as IHTMLAnchorElement).href;
List.Add(sAnchor);
end;
end;
end;
end;
procedure TForm5.WebBrowser1NavigateComplete2(ASender: TObject;
const pDisp: IDispatch;
var URL: OleVariant);
begin
GetWebBrowserHREFList(TWebBrowser(ASender),Listbox1.items)
end;