BACK TO HOME

Properties

AboutBox

Busy

Headers

HTMLDoc

Status

URL

UserAgent

Methods

GetHeaders

GetHTML

Events

StartHeaders

EndHeaders

BufferChange

StartHTML

EndHTML

Error

Error Code


PROPERTIES

Back to top

Property AboutBox As String (read only)

Returns the Error in Internet Open Function of control information and author.

Property Busy as Boolean (read only)

TRUE means control is waiting for a response from the remote server, otherwise returns FALSE when control is idle.

Property Headers As Collection (read only)

Returns collection of HTML Headers: ContentType, ContentLength, LastModified, Version, StatusCode, StatusText, RawHeaders, Forwarded, Server, RequestMethod, RequestHeaders, HeadersCRLF, UserAgent, FlatRequest.

Example:

Dim MyHeaders as New Collection 'Paste in the declaration

Private Sub Command1_Click()

 

Dim vnt as Variant

 

Hraw1.GetHeaders 'calls the GetHeaders method
Set MyHeaders = Hraw1.Headers 'retrieve the HTML headers
For Each vnt In MyHeaders

 

'print the all headers in Immediate Window
Debug.Print vnt.Name

 

Next

 

'print LastModified and StatusCode headers only
Debug.Print "Last Modified is " & MyHeaders("LastModified")
Debug.Print "Status Code is " & MyHeaders("StatusCode")

End Sub

Back to top

Property HTMLDoc As String (read only)

Returns the buffer of HTML page. This property has to be read in the BufferChange Event.
Example: See BufferChange Event.

Property Status As Integer (read only)

Returns the status of control. You can read this property after trapping an error in Error event.
Example: See Error Event

Status

Description

2

Internet session ok

3

Internet connect ok

4

HTTP Request ok

12

HTTP Query Info ok

-1

An error occurs

Property URL As String

Returns or sets the URL (Uniform Resource Locator) or Internet address that you wish to connect. Specify URL without "http://". Example, to connect to "http://msdn.microsoft.com", set this property to "msdn.microsoft.com" without "http://". Back to top

Property UserAgent As String

Returns or sets the user agent. User Agent is the name of program that you can connect to the Internet.


METHODS

Back to top

GetHeaders ( [URL as String] )

See Also

Property Headers

Method GetHTML

Parameter URL is optional. If it is omitted, the property URL is used to identify the Internet address. If both property URL and parameter URL are empty, an error occurs.
When you call this method, HRaw control will try connecting to the remote server to retrieve HTML headers of the page you specify in the URL property or URL parameter. To call this method, you need an Internet connection. If you're using proxy server, the proxy address must be set in the IE configuration. Connecting to the server and retrieving HTML headers needs a few seconds or even minutes, depending on your connection speed.

After calling this method, you can read the HTML headers from property Headers.
Example: see property Headers.
Back to top

GetHTML ( [URL as String] )

See Also

Property HTMLDoc

Method GetHeaders

Event BufferChange

Parameter URL is optional. If it is omitted, the property URL is used to identify the Internet address. If both property URL and parameter URL are empty, an error occurs.
When you call this method, HRaw control will retrieve HTML page. If you call GetHTML without first calling GetHeaders, an error occurs. This method needs an Internet connection. If you're using proxy server, the proxy address must be set in the IE configuration. Retrieving HTML needs a few seconds or even minutes, depending on your connection speed.

This method will trigger three events in this order: StartHTML event - BufferChange event - EndHTML event. The BufferChange event is triggered more than one time. The actual HTML page is stored in the property HTMLDoc. It is necessary to check the value of property HTMLDoc everytime BufferChange Event is triggered because retrieving the whole HTML page can not be done all at once. This means HRaw control store the HTML page bit by bit in the property HTMLDoc.

Example: see Event BufferChange
Back to top


EVENTS

Back to top

Event BufferChange (ByteSize As Long, Speed As Long, Cancel As Boolean)

See Also

Property HTMLDoc

Method GetHTML

This event is triggered frequently during retrieving HTML page (just after GetHTML method is called). In this event you can read HTMLDoc property to get the actual HTML page. HRaw control can not retrieve HTML page by copying the whole page into property HTMLDoc so you have to read property HTMLDoc more than one time in this event.

Parameter:

Example:

Private Sub HRaw1_BufferChange(ByVal ByteSize As Long, _
ByVal Speed As Long, Cancel As Boolean)

 

Dim i As Single

 

'Show number of bytes during retrieval of HTML page
If ByteSize > 0 Then

   

i = ByteSize / 1024 'byte size in KB
Debug.Print "Transferring " & Format(i, "##.##") & " KB"

 

Else 'if ByteSize is -1, the HTML file size is unknown.

   

Debug.Print "Speed " & Format(Speed / 1024, "##.##") & " KB"

 

End If

 

'HTMLDoc property is the property that contains the actual buffer.
'You have to keep calling this property because this property
'is always changed until the entire page is retrieved.
'Write HTML page in the Immediate Window
Debug.Print HRaw1.HTMLDoc

End Sub

Back to top

Event Error (ErrorNo As Long, ErrorMsg As String)

Occurs when there is an error. Parameter: ErrorNo is Error Number and ErrorMsg is Error Message.

Event StartHeaders

Occurs when HRaw control starts retrieving HTML headers.

Event EndHeaders

Occurs when HRaw control finishes retrieving HTML headers.

Event StartHTML

Occurs when HRaw control starts retrieving HTML page.

Event EndHTML

Occurs when HRaw control finishes retrieving HTML page.
Back to top

 


Error Code

Error Number

Error Description

31200

Error in Internet Open Function

31201

URL is not specified

31202

Page size is more than 380KB

31203

HTTP Send Request call failed

31204

HTTP Open Request call failed

31205

Internet Connect call failed

31206

Internet Open call failed

Back to top