procedure TForm1.Button1Click(Sender: TObject);
var
doc: IHTMLDocument2;
links: IHTMLElementCollection;
anchor: IHTMLAnchorElement;
SaveResult: HRESULT;
item: OleVariant;
i: Integer;
begin
WebBrowser1.Navigate(URL);
doc := WebBrowser1.Document as IHTMLDocument2;
while doc.readyState <> 'complete' do
Application.ProcessMessages;
links := doc.links;
for i := 0 to links.length-1 do begin
item := links.item(i, i);// as IHTMLAnchorElement;
if (not VarIsEmptyParam(item)) then begin
Memo1.Lines.Add(item.href);
end;
end;
end;