Here is the entire code to do what I am doing so far , I dont like how I
am doing the string replacment I would hink I could just grab it all in
a regular expression.
I am a little confused as to using th mshtml and how that would offer
any benifit over what I am doing now.
Here is how I am doing it.
Imports System.Text
Imports System.Net
Imports System.Text.RegularExpressions
Module Module1
Private IEs As New SHDocVw.ShellWindows
Private IE As SHDocVw.InternetExplorer
Private Declare Function GetForegroundWindow Lib "user32" () As
Int32
Sub Main()
Dim objWebClient As New WebClient
Dim objUTF8 As New UTF8Encoding
Dim Ret As Int32
For Each IE In IEs
'Here we will compare the ACTIVE IE.HWND
'Title is in this format
'<span class="header6">
'Tom Hawke (Orig. Title: the Link Boys)
'</span>
'Author is in this format
'
Ret = GetForegroundWindow()
If Ret = IE.HWND Then
Dim html As String =
objUTF8.GetString(objWebClient.DownloadData(IE.Loc ationURL))
'Multiple Regex here ?
Dim regex As New Regex("<span
class=""header6"">((.|\n)*?)</span>", RegexOptions.IgnoreCase)
Dim re As New Regex("<[^>]*>", RegexOptions.IgnoreCase)
Dim regex2 As New Regex("<b>Binding:</b>((.|\n)*?)<br>
<b>Publisher:", RegexOptions.IgnoreCase)
'Dim regex As New Regex("<b>Binding:</b>((.|\n)*?)<br>
<b>Publisher:", RegexOptions.IgnoreCase)
'MsgBox(IE.LocationURL)
' Dim Match = regex.Match(html)
Dim title, author, binding, condition As String
title = regex.Match(html).ToString
title = re.Replace(title, "")
binding = regex2.Match(html).ToString
binding = re.Replace(binding, "")
binding = Replace(binding, "Binding:", "")
binding = Replace(binding, "Publisher:", "")
MsgBox(Ret & Trim(title) & " " & binding)
End If
Next
End Sub
End Module
Any suggestions on how I could clean up the stripping of Title and
author would be appreciated.
Chris
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!