VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsHA7Net"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'@@clsHA7Net
'
'Description:
'clsHA7Net is a VB6 class module designed to simplify the integration
'of Embedded Data Systems' HA7Net 1-Wire Bus Master into VB6 projects.
'Most of the high-level communications that occur with the HA7Net have been
'implemented in this class file.
'
'See Also:
' mdlHA7Net_PublicTypes - Public Types we wish could be defined by this
'                         class, but VB6 does not allow the definition
'                         of public types in class modules.
'History:
' 05/23/2005 -  Initial version
'
Option Explicit

Const SO_BROADCAST As Integer = &H20&   ' Permit sending of broadcast msgs.
Const SOL_SOCKET As Long = 65535     ' Options for socket level.

Const URL_ADDRESS_DEVICE As String = "/1Wire/AddressDevice.html"
Const URL_GET_1WIRE_LOCK As String = "/1Wire/GetLock.html"
Const URL_MATCH_DEVICE As String = "/1Wire/MatchDevice.html"
Const URL_POWER_DOWN_BUS As String = "/1Wire/PowerDownBus.html"
Const URL_READ_BIT As String = "/1Wire/ReadBit.html"
Const URL_READ_DS18B20 As String = "/1Wire/ReadDS18B20.html"
Const URL_READ_FILE_RECORDS As String = "/1Wire/ReadFileRecords.html"
Const URL_READ_PAGES As String = "/1Wire/ReadPages.html"
Const URL_READ_TEMPERATURE As String = "/1Wire/ReadTemperature.html"
Const URL_RELEASE_1WIRE_LOCK As String = "/1Wire/ReleaseLock.html"
Const URL_RESET_BUS As String = "/1Wire/Reset.html"
Const URL_SEARCH As String = "/1Wire/Search.html"
Const URL_WRITE_BIT As String = "/1Wire/WriteBit.html"
Const URL_WRITE_BLOCK As String = "/1Wire/WriteBlock.html"
Const URL_WRITE_FILE_RECORD As String = "/1Wire/WriteFileRecord.html"

Private mvarHostName As String
'Private WithEvents oWebBrowser As SHDocVwCtl.WebBrowser
Private oWebBrowser As SHDocVwCtl.WebBrowser
Private WithEvents MulticastResponseListener As Winsock
Attribute MulticastResponseListener.VB_VarHelpID = -1
Private discoveredHA7Nets() As HA7NetDiscovery

Private Declare Function setsockopt Lib "wsock32.dll" (ByVal s As Long, ByVal level As Long, _
    ByVal optname As Long, optval As Any, ByVal optlen As Long) As Long

'@@DiscoverHA7Nets
'<GROUP clsHA7Net>
'Description:
' DiscoverHA7Nets() utilizes the multicast listener built into each HA7Net to
' discover any HA7Nets that are within reach of a single multicast data packet.
' This is typically limited to the local network, unless the upstream / downstream
' routers have been configured to route multicast packets.
'
' This would ideally be implemented as a static method of this class, but
' VB6 doesn't support static methods.
'
'Returns:
'   Array of HA7NetDiscovery(), defined in mdlHA7Net_PublicTypes. Note that
'   this array is handled as base(1).  That is, the first valid entry will
'   be stored in element 1, not element 0.
'
'See Also:
' mdlHA7Net_PublicTypes
' MulticastResponseListener_DataArrival
'
'History:
'  05-23-2005  Initial Version
Friend Function discoverHA7Nets() As HA7NetDiscovery()
  
  Dim sckHndl As Long
  'Start by re-initializing storage space for any received
  'responses
  ReDim discoveredHA7Nets(0)
  
  'Transmit the multicast packet out to the network
  'Any responses received from HA7Nets will be received and parsed
  'by the Winsock1_DataArrival event function, below.
  Set MulticastResponseListener = frmInetControls.Winsock1
  MulticastResponseListener.protocol = sckUDPProtocol
  sckHndl = MulticastResponseListener.SocketHandle
  setsockopt sckHndl, SOL_SOCKET, SO_BROADCAST, 1, 1
  With MulticastResponseListener
    .RemotePort = 4567
    .RemoteHost = "224.1.2.3"
    .SendData "HA" & vbNullChar & ChrW$(1)
  End With
  
  'Suspend this thread for 1 second to wait for all responses to come back.
  'This time can be tweaked based on the network topology.
  'Any responses received from HA7Nets will be received and parsed
  'by another thread in the Winsock1_DataArrival event function, below.
  Dim startTime As Single
  startTime = Timer
  Do While Abs(Timer - startTime) < 1
    DoEvents
  Loop
  
  'Clean-up resources and return the results
  MulticastResponseListener.Close
  'Return the results
  discoverHA7Nets = discoveredHA7Nets()
  
End Function



'@@MulticastResponseListener_DataArrival
'<GROUP clsHA7Net>
'Description:
'  When incoming data arrives at the port, this will pull it out of
'  the socket, then parse it looking for valid HA7Net responses to
'  the multicast discovery packet.
'
'See Also:
' DiscoverHA7Nets
Private Sub MulticastResponseListener_DataArrival(ByVal bytesTotal As Long)
    Dim responseData As String
    Dim ha7NetCount As Integer
    MulticastResponseListener.GetData responseData, vbString, bytesTotal
    
    'Examine the response to see if it's valid
    'Length of data should be 84 bytes
    If Len(responseData) <> 84 Then
      'Not a valid response
      Exit Sub
    End If
    
    If Left$(responseData, 2) <> "HA" Then
      'Response is not from a standard HA7Net
      Exit Sub
    End If
    
    If (Asc(Mid$(responseData, 3, 1)) * 256&) + Asc(Mid$(responseData, 4, 1)) <> 32769 Then
      'Wrong command code contained in the response
      Exit Sub
    End If
    
    'Seems like a valid response
    'Create storage space for the response
    ha7NetCount = UBound(discoveredHA7Nets) + 1
    ReDim Preserve discoveredHA7Nets(ha7NetCount) As HA7NetDiscovery
    
    'Now parse it
    With discoveredHA7Nets(ha7NetCount)
      .DeviceName = Mid$(responseData, 21, 64)
      If (InStr(1, .DeviceName, vbNullChar)) > 0 Then
        'Strip off the null terminator, if present
        .DeviceName = Left$(.DeviceName, InStr(1, .DeviceName, vbNullChar) - 1)
      End If
      .HTTPPort = (AscW(Mid$(responseData, 5, 1)) * 256&) + AscW(Mid$(responseData, 6, 1))
      .HTTPSPort = (AscW(Mid$(responseData, 7, 1)) * 256&) + AscW(Mid$(responseData, 8, 1))
      .IPAddress = MulticastResponseListener.RemoteHostIP
      .MACAddress = Trim$(Mid$(responseData, 9, 12))
      .Signature = Mid$(responseData, 1, 2)
    End With

End Sub

Friend Function OW_ReadTemperature(AddressList() As String, Optional lockId As String = "") As HA7Net_ReadTemperatureResults()
    Dim htmlResponse As HTMLDocument
    Dim resultDataTable As HTMLTable
    Dim resultRows As IHTMLElementCollection
    Dim resultRow As HTMLTableRow
    
    Dim resultElements As IHTMLElementCollection
    
    'Dim resultCells As IHTMLElementCollection
    Dim address_Array As String
    Dim parameters As String
    Dim OW_Temperatures() As HA7Net_ReadTemperatureResults
    Dim t As Integer
    
    'Build the Address Array parameter to pass to the HA7Net
    For t = 1 To UBound(AddressList)
      address_Array = address_Array & AddressList(t)
      If t < UBound(AddressList) Then
        address_Array = address_Array & ","
      End If
    Next
           
    parameters = appendParameter(parameters, "Address_Array", address_Array)
    If lockId <> "" Then
      parameters = appendParameter(parameters, "LockID", lockId)
    End If
        
    'Interact with the HA7NET
    Set htmlResponse = txHA7Net(URL_READ_TEMPERATURE & parameters)
       
    'Get results
    ReDim OW_Temperatures(0)
    'Get section of html page discussing pages read
    Set resultDataTable = htmlResponse.getElementById("Temperature")
    Set resultRows = resultDataTable.rows
    For Each resultRow In resultRows
      Set resultElements = resultRow.getElementsByTagName("INPUT")
      If resultElements.length = 3 Then
        'Found a valid temperature sensor row
        'Allocate local storage space for addresses
        ReDim Preserve OW_Temperatures(UBound(OW_Temperatures) + 1) As HA7Net_ReadTemperatureResults
        OW_Temperatures(UBound(OW_Temperatures)).SensorAddress = resultElements(0).Value
        OW_Temperatures(UBound(OW_Temperatures)).Temperature = resultElements(1).Value
        OW_Temperatures(UBound(OW_Temperatures)).Resolution = resultElements(2).Value
      End If
    Next
    
    'Return the array of temperature data to the caller
    OW_ReadTemperature = OW_Temperatures
  
End Function
Friend Function OW_ReadDS18B20(RequestList() As HA7Net_ReadDS18B20Request, Optional lockId As String = "") As HA7Net_ReadTemperatureResults()
    Dim htmlResponse As HTMLDocument
    Dim resultDataTable As HTMLTable
    Dim resultRows As IHTMLElementCollection
    Dim resultRow As HTMLTableRow
    
    Dim resultElements As IHTMLElementCollection
    
    'Dim resultCells As IHTMLElementCollection
    Dim address_Array As String
    Dim parameters As String
    Dim OW_Temperatures() As HA7Net_ReadTemperatureResults
    Dim t As Integer
    
    'Build the Address Array parameter to pass to the HA7Net
    For t = 1 To UBound(RequestList)
      address_Array = address_Array & "{"
      address_Array = address_Array & RequestList(t).SensorAddress
      address_Array = address_Array & ","
      address_Array = address_Array & RequestList(t).Resolution
      address_Array = address_Array & "}"
      If t < UBound(RequestList) Then
        address_Array = address_Array & ","
      End If
    Next
           
    parameters = appendParameter(parameters, "DS18B20Request", address_Array)
    If lockId <> "" Then
      parameters = appendParameter(parameters, "LockID", lockId)
    End If
        
    'Interact with the HA7NET
    Set htmlResponse = txHA7Net(URL_READ_DS18B20 & parameters)
       
    'Get results
    ReDim OW_Temperatures(0)
    'Get section of html page discussing pages read
    Set resultDataTable = htmlResponse.getElementById("Temperature")
    Set resultRows = resultDataTable.rows
    For Each resultRow In resultRows
      Set resultElements = resultRow.getElementsByTagName("INPUT")
      If resultElements.length = 3 Then
        'Found a valid temperature sensor row
        'Allocate local storage space for addresses
        ReDim Preserve OW_Temperatures(UBound(OW_Temperatures) + 1) As HA7Net_ReadTemperatureResults
        OW_Temperatures(UBound(OW_Temperatures)).SensorAddress = resultElements(0).Value
        OW_Temperatures(UBound(OW_Temperatures)).Temperature = resultElements(1).Value
        OW_Temperatures(UBound(OW_Temperatures)).Resolution = resultElements(2).Value
      End If
    Next
    
    'Return the array of temperature data to the caller
    OW_ReadDS18B20 = OW_Temperatures
  
End Function
'@@OW_ReadFileRecords
'<GROUP clsHA7Net>
'
'Description:
' Used to read file records from properly formatted iButton / 1-Wire devices
'
'Parameters:
' FileRecordsToRead - Integer representing the number of file records to be read
' StartRecord -       Optional Integer representing the record number to start reading at.
'
'Return Value:  Array of Strings representing the content of the file records.
'
'History:
' 05/23/2005 -  Initial version
'
Public Function OW_ReadFileRecords(FileRecordsToRead As Integer, Optional StartRecord As Integer = -99, Optional DeviceAddress As String = "") As String()
    Dim htmlResponse As HTMLDocument
    Dim resultDataTable As IHTMLTable
    Dim resultElements As IHTMLElementCollection
    Dim parameters As String
    Dim fileRecords() As String
    Dim t As Long
    
    If StartRecord <> -99 Then
        parameters = appendParameter(parameters, "StartRecord", CStr(StartRecord))
    End If
    parameters = appendParameter(parameters, "FileRecordsToRead", CStr(FileRecordsToRead))
    If DeviceAddress <> "" Then
        parameters = appendParameter(parameters, "Address", DeviceAddress)
    End If
    
    'Interact with the HA7NET
    Set htmlResponse = txHA7Net(URL_READ_FILE_RECORDS & parameters)
           
    'Get section of html page discussing File Records
    Set resultDataTable = htmlResponse.getElementById("FileRecords")
    Set resultElements = resultDataTable.getElementsByTagName("INPUT")
    
    'Allocate local storage space for records
    ReDim fileRecords(resultElements.length) As String
    
    'Copy the File Records into a string array for returning to caller
    For t = 0 To resultElements.length - 1
        fileRecords(t) = resultElements(t).Value
    Next t
    
    'Return the array of serial numbers to the caller
    OW_ReadFileRecords = fileRecords()
    
End Function

'@@OW_ReadPages
'<GROUP clsHA7Net>
'
'Description:
' Used to read memory pages from iButton / 1-Wire devices that support it.
'
'Parameters:
' numPages - Integer representing the number of pages to be read
' StartPageNumber -       Optional Integer representing the page number to start reading at.
' DeviceAddress - Optional String representing the ROMId of the 1-Wire device to read from.
'
'Return Value:  Array of Strings representing the content of the memory pages.
'
'History:
' 05/23/2005 -  Initial version
'
Public Function OW_ReadPages(numPages As Integer, Optional StartPageNumber As Integer = -99, Optional DeviceAddress As String = "", Optional lockId As String = "") As String()
    Dim htmlResponse As HTMLDocument
    Dim resultDataTable As IHTMLTable
    Dim resultElements As IHTMLElementCollection
    Dim parameters As String
    Dim OW_Pages() As String
    Dim t As Integer
    
    If StartPageNumber <> -99 Then
        parameters = appendParameter(parameters, "StartPage", CStr(StartPageNumber))
    End If
    parameters = appendParameter(parameters, "PagesToRead", CStr(numPages))
    If lockId <> "" Then
      parameters = appendParameter(parameters, "LockID", lockId)
    End If
    
    If DeviceAddress <> "" Then
        parameters = appendParameter(parameters, "Address", DeviceAddress)
    End If
    
    'Interact with the HA7NET
    Set htmlResponse = txHA7Net(URL_READ_PAGES & parameters)
       
    'Get results
    'Get section of html page discussing pages read
    Set resultDataTable = htmlResponse.getElementById("PAGES")
    Set resultElements = resultDataTable.getElementsByTagName("INPUT")
    
    'Allocate local storage space for addresses
    ReDim OW_Pages(resultElements.length) As String
    
    'Copy the 1-Wire pages into a string array for returning to caller
    For t = 0 To resultElements.length - 1
        OW_Pages(t) = resultElements(t).Value
    Next t
    
    'Return the array of serial numbers to the caller
    OW_ReadPages = OW_Pages()
  
    
    
    
End Function

'@@OW_AddressDevice
'<GROUP clsHA7Net>
'
'Description:
' This command will reset the 1-Wire bus, and then select the
' particular 1-Wire device on the 1-Wire bus that you want to
' talk to. Generally, communications on the 1-Wire bus occur
' between the bus master (HA7Net), and a single 1-Wire device.
' Before you can have communications with that particular
' device, you must select the device which accomplishes two
' things:
'
'       1. It tells the device you are addressing that you
'          intend to communicate with it.
'       2. All other devices drop off of the bus until the next
'          bus reset.
'
' Note:
' The HA7Net will reset the bus during the address, so an
' explicit Reset is not neccessary prior to calling this.
'
'Parameters:
' DeviceAddress - 16 Byte HEX string representing the ROMId of the device to be addressed.
'
'History:
' 05/23/2005 -  Initial version
'
Public Function OW_AddressDevice(DeviceAddress As String, Optional lockId As String) As String
    Dim parameters As String
    parameters = appendParameter(parameters, "Address", DeviceAddress)
    If lockId <> "" Then parameters = appendParameter(parameters, "LockID", lockId)
    
    txHA7Net URL_ADDRESS_DEVICE & parameters
End Function

'@@OW_GetLock
'<GROUP clsHA7Net>
'
'Description:
' Requests exclusive use of the 1-Wire bus from the HA7Net
'Returns:
' Valid lock-id, if successful
Public Function OW_GetLock() As String
    Dim htmlResponse As HTMLDocument
    Dim resultDataTable As IHTMLTable
    Dim resultElements As IHTMLElementCollection
    Dim parameters As String
      
    'Interact with the HA7NET
    Set htmlResponse = txHA7Net(URL_GET_1WIRE_LOCK & parameters)
       
    'Get results
    OW_GetLock = htmlResponse.getElementById("LockID_0").Value

End Function

'@@OW_ReleaseLock
'<GROUP clsHA7Net>
'
'Description:
' Releases exclusive use of the 1-Wire bus from the HA7Net
'Parameters:
' LockId previously aquired via OW_GetLock()
'
Public Sub OW_ReleaseLock(lockId As String)
    Dim htmlResponse As HTMLDocument
    Dim resultDataTable As IHTMLTable
    Dim resultElements As IHTMLElementCollection
    Dim parameters As String
      
    parameters = appendParameter(parameters, "LockID", lockId)
    'Interact with the HA7NET
    Set htmlResponse = txHA7Net(URL_RELEASE_1WIRE_LOCK & parameters)
      
    'Get results
    'OW_WriteBlock = htmlResponse.getElementById("ResultData_0").Value

End Sub


'@@OW_WriteBlock
'<GROUP clsHA7Net>
' Perhaps the most important HA7Net command, the Write Block
' command allows you to write and read any raw data to the
' 1-Wire bus under any context. This will allow you to
' implement any device specific protocols.
'
' If the optional ‘Address’ parameter is specified, the HA7Net
' will first reset the 1-Wire bus, then select the device
' having that address prior to writing the block of data to the
' bus. If the ‘Address’ parameter is not present, then the
' HA7Net will simply write the data and reads data back from
' the bus without regard for the current state of the bus.
'
' While a complete understanding of the 1-Wire electrical
' interface is not necessary, there is an important concept for
' you to understand in order to effectively use this command.
' Every 1-Wire device can only talk back to the bus master
' during a read cycle on the bus. The only time that read
' cycles are created on the bus is immediately after each bit
' that the host master writes to the bus. Therefore, if the
' response you expect to read back from the 1-Wire bus is
' longer than the data you intend to write to the bus, you must
' pad the data you are writing with 1 bits in order to generate
' the necessary time slots for the devices to write their
' entire response back to you. In short, you can only read as
' many bits from the 1-Wire bus as you write. For a complete
' explanation of 1-Wire bus timing and communication, please
' see chapter one of the Book of DS19xx iButton Standards from
' Dallas Semiconductor.
'
'
' Parameters:
' DeviceAddress - Optional 16 Byte HEX string representing the ROMId
'                 of the device to write to.
'                hex string.
' WhatToWrite :  1-28 bytes of data formatted as Hex.
'
' Returns:
'   String that contains the data read back from the 1-Wire bus.
Public Function OW_WriteBlock(WhatToWrite As String, Optional DeviceAddress As String = "", Optional lockId As String = "") As String
    Dim htmlResponse As HTMLDocument
    Dim resultDataTable As IHTMLTable
    Dim resultElements As IHTMLElementCollection
    Dim parameters As String
      
    parameters = appendParameter(parameters, "Data", WhatToWrite)
    If DeviceAddress <> "" Then
        parameters = appendParameter(parameters, "Address", DeviceAddress)
    End If
    If lockId <> "" Then
        parameters = appendParameter(parameters, "LockID", lockId)
    End If
    'Interact with the HA7NET
    Set htmlResponse = txHA7Net(URL_WRITE_BLOCK & parameters)
       
    'Get results
    OW_WriteBlock = htmlResponse.getElementById("ResultData_0").Value

End Function

'@@OW_ResetBus
'<GROUP clsHA7Net>
' Description:
'   This command is used to reset the 1-Wire bus. Resetting the
'   bus returns all devices on the bus to the addressing mode,
'   where they wait for you to select the next device(s) that you
'   want to talk to.
Public Sub OW_ResetBus(Optional lockId As String = "")
    Dim response As HTMLDocument
    Dim parameters As String
    If lockId <> "" Then
        parameters = appendParameter(parameters, "LockID", lockId)
    End If
    Set response = txHA7Net(URL_RESET_BUS & parameters)
End Sub

'@@OW_SearchDevices
'<GROUP clsHA7Net>
'Description:
'  Implements the 1-Wire search algorithm including each of the
'  regular search, family search, and conditional search
'  functionalities. This function is used to discover the 64-bit
'  ROM codes (addresses) of devices connected to the 1-Wire bus.
'  The search function can optionally restrict the returned list
'  of addresses to include only those devices belonging to a
'  particular family, and/or those that are in a device defined
'  conditional state.
'
'Parameters:
' FamilyCode :   Optional hex string representing the family code to
'                which the results should be limited.
' Conditional :  Optional boolean, set true if only devices in a conditional state are to be
'                returned.
'
'Returns:
' String array containing ROMIds of the 1-Wire devices found.
Public Function OW_SearchDevices(Optional familyCode As String = "", Optional conditionalSearch As Boolean = False) As String()
    Dim htmlResponse As HTMLDocument
    Dim addressTable As IHTMLTable
    Dim addressElements As IHTMLElementCollection
    Dim parameters As String
    Dim OW_Addresses() As String
    Dim t As Long
    
    'Build the URL to include optional parameters
    If familyCode <> "" Then
        parameters = appendParameter(parameters, "FamilyCode", familyCode)
    End If
    If conditionalSearch = True Then
        parameters = appendParameter(parameters, "Conditional", "TRUE")
    End If
    
    'Get data from the HA7NET
     Set htmlResponse = txHA7Net(URL_SEARCH & parameters)
    'Set htmlResponse = txHA7Net("C:\search_reply.html", True) 'For local debuggging
    
    'Get section of html page discussing 1Wire Addresses
    Set addressTable = htmlResponse.getElementById("ADDRESSES")
    Set addressElements = addressTable.getElementsByTagName("INPUT")
    
    'Allocate local storage space for addresses
    ReDim OW_Addresses(addressElements.length) As String
    
    'Copy the 1-Wire Addresses into a string array for returning to caller
    For t = 1 To addressElements.length
        OW_Addresses(t) = addressElements(t - 1).Value
        'Debug.Print OW_Addresses(t)
    Next t
    
    'Return the array of serial numbers to the caller
    OW_SearchDevices = OW_Addresses()
    
End Function

'@@txHA7Net
'<GROUP clsHA7Net>
'
'Description:
' txHA7Net is responsible for the actual data exchange with the HA7Net.
'
'Parameters:
' URL - String representing the complete URL to be loaded.  The URL should not include
'       the hostname or protocol specifier (http://).
' loadLocally - Optional boolean specifying that the URL should be loaded from the local drive
'               instead of the network.  Useful for debugging if an HA7Net is not available.
'
'Returns:
' HTMLDocument as defined in MSHTML.
Private Function txHA7Net(URL As String, Optional loadLocally As Boolean = False) As HTMLDocument
    oWebBrowser.Stop
    Do While oWebBrowser.ReadyState <> READYSTATE_COMPLETE
        DoEvents
    Loop
    
    If loadLocally Then
        oWebBrowser.Navigate2 URL
    Else
    '    Debug.Print CStr(Timer) & " TX- " & URL
        oWebBrowser.Navigate2 "http://" & mvarHostName & URL
    End If
    Do While oWebBrowser.ReadyState <> READYSTATE_COMPLETE
        DoEvents
        'I really wish VB either had a 'Wait' mechanism or
        'the WebBrowser control offered a synchronous call
    Loop
    ' Debug.Print CStr(Timer) & " RX- Response to " & URL
    Set txHA7Net = oWebBrowser.Document
End Function

'@@appendParameter
'<GROUP clsHA7Net>
'
'Description:
' Helper function used in building the URLs to be requested from the HA7Net
'
'Parameters:
' parameters - String to which the parameter will be appended.
' parameterName - String specifying the name of the parameter.
' parameterValue - String specifying the value of the parameter.
'
'Returns -
' String containg the existing parameter string passed in the parameters argument,
' with the new parameter name and value appended to it as appropriate.
Private Function appendParameter(parameters As String, parameterName As String, parameterValue As String) As String
    If parameters <> "" Then
        parameters = parameters & "&"
    Else
        parameters = "?"
    End If
    parameters = parameters & parameterName & "=" & parameterValue
    appendParameter = parameters
End Function

Public Property Get WebBrowser() As SHDocVwCtl.WebBrowser
    Set WebBrowser = oWebBrowser
End Property

Public Property Let WebBrowser(ByRef oNewWebBrowser As SHDocVwCtl.WebBrowser)
    Set oWebBrowser = oNewWebBrowser
End Property
Public Property Let HostName(HostName_OR_IPAddress As String)
    mvarHostName = HostName_OR_IPAddress
End Property
Public Property Get HostName() As String
    HostName = mvarHostName
End Property
