Link to home
Start Free TrialLog in
Avatar of nikola_mk
nikola_mk

asked on

How can I extract all of links from TWebBrowser

How can I extract all of links fromTWebBrowser and put in ex. TMemo or RichEdit.
Like CopyShortcut in
Internet Explorer but for all links
on TWebBrowser

ASKER CERTIFIED SOLUTION
Avatar of alikoank
alikoank

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You also need to add MSHTML_TLB to your uses clause.  If you do not have MSHTML_TLB you can create it by using the menu in delphi Project->Import Type Library->select 'Micrsoft HTML Object Library', unselect 'Generate Component Wrapper', click 'Create Unit'.

In the above code one line needs to be slightly modified:
       currlink := links.Item(i,'') as IHTMLElement;

If you wish to get more information out of the hyperlink you can:
var
  htmlLink: IHTMLAnchorElement;

htmlLink := links.item(i,'') as IHTMLAnchorElement;
then you have access to all the properties of the anchor element:
http://msdn.microsoft.com/workshop/browser/mshtml/reference/ifaces/anchorelement/anchorelement.asp