Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How can I extract all of links from TWebBrowser

Posted on 2004-08-05
2
Medium Priority
?
792 Views
Last Modified: 2008-01-09
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

0
Comment
Question by:nikola_mk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
alikoank earned 450 total points
ID: 11729816
var
  doc: IHTMLDocument2;
  links: IHTMLElementCollection;
  currlink:IHTMLElement;
  i: integer;
begin
  doc := WebBrowser.Document as IHTMLDocument2;
  links := doc.Links;
  for i := 0 to links.length -1 do begin
         currlink := link.Item(i,'') as IHTMLElement;
         Memo1.lines.add(currlink.toString);
  end;
0
 
LVL 4

Expert Comment

by:ErikPhilips
ID: 11739843
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
   
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question