I`m not sure but i have an idea:First you can get the HTML code of the page and then search the "<a href=" tag (hyperliks tag).The address between this tag is the url.
Tip1-You can search the text by InSrt().see object browser.
Tip2-the link may be a picture.
Tip3-read some about html tags. Behnam2204@yahoo.com
BehnamPro
you can get to the hyperlinks collection of the webbrowser document quite easily...
to loop thru the hyperlinks in VB, simply write..
for i = 0 to webbrowser.document.links
debug.print webbrowser.document.links(i).href
next
to download a file to your PC...
Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Hi guys,
The webbrowser control is essentially IE without the container it is the part of IE that you view web pages in. It can be added to a VB project by adding the Microsoft Internet Control (shdocvw.dll)
PS. getting the current link under the mouse is not easy
especially not with VB. StatusTextChange sometimes is set by the web designer to show alternative text in the status bar. This would therefore cause a problem if you presumed all it is displaying is urls. Also trying to check if the statustext is a valid url can get intensive especially if the site designer has scrolling messages in the status bar.
There is another way to gain access to the Document object model of a web page in VB and that is by adding a reference to to shdocvw.dll (no need to add the component if you dont wont to display the actual web page). Then write the following ...
(createDocumentFromUrl is only available for IE5 and above)
Dim oMSHTML As New MSHTML.HTMLDocument
Dim oDocument As MSHTML.HTMLDocument
Set oDocument = objMSHTML.createDocumentFromUrl("
hi,
yes, i am working with shdocvw.dll rather then simple web browser. And i am facing problem with StatusTextChange. This was the reason for this post.
sjravee your code for viewing all links is perfect but how to check individual links with mouse.
Is their a way to get other details from Links Collection like link's text (text which user sees) and also
information with mouse hover operation (perhaps with StausTextChange. if this is possible then comparsion can be done to get the actual URL from the link.
Unfortunately statustextchange does not let you know which element caused the text to change
for other link properties:
for i = 0 to oDocument.links.length - 1
debug.print oDocument.links(i).href
debug.print oDocument.links(i).target
debug.print oDocument.links(i).innerText
debug.print oDocument.links(i).innerHTML
next
innerText is the text you see inside a link, however sometimes there are images and other HTML elements that are linked, so innerHTML will let you know the HTML that is enclosed in the a tag. Image map hrefs also will appear in the links collection.
to recieve events such as onmouseover etc you need to
first create a docobject that will respond to events...
private withevents objHTMLDoc as HTMLDocument
you will then be able to trap the event and interogate the element that fired the event
You will find a good example, near the bottom of the page, at:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.