|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
MSHTML Help
Hi, I was wondering if anyone can point me in the right direction as to getting help with the MSHTML object. Basically I want to be able to read the HTML (Like attributes, not the HTML itself, that I can do). Any help would be appreciated.
Thanks, Chris |
|
#2
|
|||
|
|||
|
There is a simple code about MSHtml object & VB:
Goto Project -> References and add a Reference to Microsoft Internet Controls (SHDOCVW.DLL) and one to the Microsoft HTML Object Library (MSHTML.TLB). Add a ListBox to your Form called List1. Then add this to the Form_Load or under a command button. This code will create a new instance of internet explorer (although it will not be set to visible.) then it will goto Altavista and once the web page has finished loading it will get a list of all the links and place them in the Listbox. As you can see this is much easier than parsing each of these links all by yourself, and probably faster too. Please note that the loop waiting for the web page to load is very sloppy, but was just added to demonstrate this functionality. Normally there should be code in the DocumentComplete Event of the InternetExplorer object to handle this functionality. Dim Web As New SHDocVw.InternetExplorer Dim Doc As New MSHTML.HTMLDocument Dim e As MSHTML.HTMLGenericElement Dim a As MSHTML.HTMLAnchorElement Do Until Web.Busy = False DoEvents Loop Web.navigate "http://altavista.com/" Set Doc = Web.Document For Each e In Doc.All If e.tagName = "A" Then Set a = e List1.AddItem a.href End If Next |
|
#3
|
|||
|
|||
|
thanks alot
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > MSHTML Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|