HTM Raw ActiveX Control

Quick Start

Properties

Methods

Events

HTMRaw is an ActiveX Control that enables you to retrieve HTML page and headers. This control has been tested in Windows 95, Windows 98 and Windows NT 4.0. To use and test your program with HTMRaw ActiveX control, you need an Internet connection. It is recommended to install Microsoft Internet Explorer 4.0 or later before using HTMRaw.

Copyright and License

You can use this control as a FREEWARE for educational and hobby purposes. This control will be SHAREWARE for commercial purposes (email me for further information). You are allowed to use this control if you agree that no support will be provided and use it at your own risk. If you have comments and suggestions, email me at sar@writeme.com

HTMRaw DOES NOT contain any constituent controls (intrinsic controls or Visual Basic standard built-in control or any other ActiveX controls). It is unlawful to create a new ActiveX control using HTMRaw control as a constituent control.

Versions

HTMRaw has two versions:

HTMRaw contains API calls to wininet.dll (Internet Extensions for Win32 included in Internet Explorer). This control is created and tested to call wininet version 4.72.3110.0. If you connect to Internet using proxy server, you must set the proxy address from the IE configuration.

HTML headers are the information sent by the remote server before the actual HTML page is retrieved. In the browsers such as Microsoft Internet Explorer and Netscape Communicator, HTML headers are not shown to user. Examples of HTML headers are the type of web server, page size, and date of page modification.

To retrieve HTML headers, you call GetHeaders method and to get the actual HTML page, call GetHTML method. You can specify the URL (Internet address) as a parameter to both methods. Without this parameter, you must set the URL property.

Control Details and Limitation

 

HTM Raw Version 1.0/1.1

HTM Raw Version 2.0 *

File size limitation

380 KB

No Limit

Threading model

Apartment Threaded

Apartment Threaded

File format supported

Htm/html/text

Any format

UserID-password connection

Not supported

Supported

SSL protocol

Not supported

Supported

Proxy server configuration

**

**

Local Intranet address

Not supported

Supported

* Future release of HTM Raw
** follows the Internet Explorer setting in registry


Quick Start

Back to top

Follow this step-by-step guide to create a simple program to retrieve HTML page using Visual Basic and HTMRaw ActiveX control. Note that you need an Internet connection to debug and test your program.

  1. Create a new Project - Standard EXE from Visual Basic menu. Form1 is automatically created.
  2. Select Component from Project menu or press Ctrl-T to show the pop-up window of Components. On the Controls tab, select HTM Raw 1.1 ActiveX control (or HTM Raw 1.0) and press OK.
  3. Place one HTMRaw control, one label, one command button and two text boxes on Form1 by drawing them onto our form. Set the following properties of those controls:
  4. Name

    Properties

    Form1

    Height = 6200
    Width = 6500

    Label1

    Caption = URL

    Text1

    Text = www.geocities.com/tokyo/garden/9484/ or your own URL

    Text2

    Multiline = True
    Scrollbars = 3 - Both
    Height = 4500
    Width = 5800

    Set your form and controls to the following layout:

  5. Copy this code into your form code:
  6. Private Sub Form_Load()

     

    Text1.Text = "www.geocities.com/tokyo/garden/9484/"

    End Sub

    Private Sub WriteLine(Str As String)

     

    'This procedure will add a new line
    'in the Text2 box.
    Text2.Text = Text2.Text & vbCrLf & Str
    DoEvents

    End Sub

    Private Sub Command1_Click()

     

    'This procedure will retrieve HTML page from
    'the URL in Text1 box.
    If Len(Text1.Text) <> 0 Then
    HRaw1.URL = Text1.Text
    HRaw1.UserAgent = "HRAW ActiveX Control"
    HRaw1.GetHeaders
    HRaw1.GetHTML
    End If

    End Sub

    Private Sub HRaw1_StartHTML()

     

    'This event is triggered just
    'before HRaw control requests the page.
    WriteLine "Start retrieving HTML page..."

    End Sub

    Private Sub HRaw1_EndHTML()

     

    'This event is triggered after HRaw control
    'receives HTML page.
    WriteLine "Finish retrieving"

    End Sub

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

     

    'This event is triggered a few times
    'after GetHTML method is called.
    'Property HTMLDoc is the variable that stores the HTML page.
    WriteLine HRaw1.HTMLDoc

    End Sub

     

  7. Press F5 to run your project.