Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 19th, 2003, 06:30 PM
nyk52687 nyk52687 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: NY
Posts: 13 nyk52687 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to nyk52687 Send a message via AIM to nyk52687 Send a message via Yahoo to nyk52687
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

Reply With Quote
  #2  
Old December 21st, 2003, 09:01 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
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

Reply With Quote
  #3  
Old December 21st, 2003, 10:03 AM
nyk52687 nyk52687 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: NY
Posts: 13 nyk52687 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to nyk52687 Send a message via AIM to nyk52687 Send a message via Yahoo to nyk52687
thanks alot

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > MSHTML Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT