Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browsing from VB6 DLL

Status
Not open for further replies.

GuyC

Programmer
Oct 8, 2002
5
US
Hello,
I would like to build a VB6 dll that retrieves html content based on a url which I provide.
This needs to be a dll,not an exe... no form/user interface.
I need it to be a dll, because this will be executed server-side and then some additional logic is performed on the retrieved html and then feedback is sent back to the user via asp web page.

I realize that there is a WebBrowser control.
I am able to accomplish my task using this control when I build a VB6 form, but when I try to do it from a class, where there is no form, I get an error.

My class is shown below, I get the error on this line...
lWebBrowser.Navigate lURL

The error I get is this...
err.number = -2147467259
err.description = Automation error Unspecified error

Is there another object/class that would allow me to programatically "read" the content of a url from within a VB6 class (i.e. no user interface) ?
thx

Here is a slimmed version of my class

Option Explicit
Dim lURL As String
Dim lContent As String
Property Let URL(pURL As String)
lURL = pURL
End Property
Property Get URL() As String
URL = lURL
End Property
Sub ExecuteURL()
If Len(lURL) > 0 Then
Dim lWebBrowser As WebBrowser
Set lWebBrowser = New WebBrowser
lWebBrowser.Navigate lURL
lContent = lWebBrowser.Document
Set lWebBrowser = Nothing
Else
lContent = "NO URL PROVIDED"
End If
End Sub
Property Get Content() As String
Content = lContent
End Property


The VB Code to use this class would be...
(ultimately, this will be used from vbscript in an .asp web page)

Dim oWebUtil As MyWebUtil.clsMyWebUtil
Set oWebUtil = New MyWebUtil.clsMYWebUtil
oWebUtil.URL = "oWebUtil.ExecuteURL
debug.Print oWebUtil.Content
Set oWebUtil = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top