Figure 2

Figure 2 Quote.ctl Extract
Private m_StockSymbol As String
Public Property Get StockSymbol() As String
  StockSymbol = m_StockSymbol
End Property

Public Property Let StockSymbol(ByVal StockSymbol As String)
  m_StockSymbol = StockSymbol
  
  PropertyChanged ("StockSymbol")
 
  Timer1_Timer
End Property

Private Sub UserControl_Initialize()
  m_StockSymbol = "MSFT"  
End Sub
Figure 3 UserControl_DblClick Event
Private Sub UserControl_DblClick()
Dim sHTMLURL As String
  On Error Resume Next
  sHTMLURL = http://quotes.nasdaq.com/quote.dll?" _
    page=multi&mode=stock
    &symbol=" & m_StockSymbol &     "&symbol=&symbol=&symbol=&symbol=" _
    &symbol=&symbol=&symbol=&symbol=&symbol="
  Hyperlink.NavigateTo sHTMLURL
  Exit Sub  
HandleHyperLinkError:
  Print "Error: " & Err.Description
End Sub
Figure 4 Timer1_Timer Event
Private Sub Timer1_Timer()
Dim sHTMLURL As String
  If Ambient.UserMode Then
    On Error Resume Next
    CancelAsyncRead "quote"
    CancelAsyncRead "company"
    CancelAsyncRead "history"
    On Error GoTo HandleAsyncReadError
    
    sHTMLURL = http://quotes.nasdaq.com/Quote.dll? _
    mode=stock&symbol=" & m_StockSymbol & _
    "&symbol=&symbol=&symbol=&symbol=&symbol=" _
    &symbol=&symbol=&symbol=&symbol=&quick.x=0&quick.y=0"
    
    AsyncRead sHTMLURL, vbAsyncTypeByteArray, "quote"
    
    sHTMLURL = "http://www.nasdaq.com/logos/" + _
    m_StockSymbol + ".GIF"
    AsyncRead sHTMLURL, vbAsyncTypePicture, "company"
    
    sHTMLURL = "http://charting.nasdaq.com/nd/M/" & _    
               m_StockSymbol & "06.gif"
    AsyncRead sHTMLURL, vbAsyncTypePicture, "history"
  End If
  
  Timer1.Interval = 65535
  
  lblStatus.Caption = "Last checked at " & Now()
  Exit Sub

HandleAsyncReadError:
  Print "Error getting quotes: ", Err.Description
End Sub
Figure 5 HandleAsyncPicture Function
Private Sub HandleAsyncPicture(asyncprop As AsyncProperty)
  On Error Resume Next
  Dim StockPicture As Picture
  Set StockPicture = asyncprop.Value  
  If asyncprop.PropertyName = "company" Then
    CurrentY = 950
    CurrentX = 600
  Else
    CurrentY = 1500
    CurrentX = (ScaleWidth - ScaleX(StockPicture.Width, _
    vbHimetric, vbTwips)) / 2
  End If
  PaintPicture StockPicture, CurrentX, CurrentY
End Sub
Figure 6 HandleAsyncHTML Function
Private Sub HandleAsyncHTML(asyncprop As AsyncProperty)
  Dim HTMLAsByteArray() As Byte
  Dim HTMLByteCount As Integer
  Dim HTMLAsString As String
  Dim HTMLAsStringTemp As String
  Dim StockQuoteTime As String
  Dim StockQuoteInfo As String
  Dim i As Long
  Dim j As Long
  
  On Error GoTo HandleAsyncReadError
  HTMLAsByteArray = asyncprop.Value
  HTMLByteCount = UBound(HTMLAsByteArray)
  
  For i = 1 To HTMLByteCount
    HTMLAsString = HTMLAsString + Chr$(HTMLAsByteArray(i))
  Next i
  
  On Error GoTo HandleBadHTMLError
  
  i = InStr(1, HTMLAsString, "As of")
  If i = 0 Then GoTo HandleBadStockSymbol
  HTMLAsStringTemp = Right(HTMLAsString, Len(HTMLAsString) - _
    (i + 4))
  j = InStr(1, HTMLAsStringTemp, "</font>")
  StockQuoteTime = Trim(Left$(HTMLAsStringTemp, j - 1))
  
  i = InStr(1, HTMLAsString, "<b>$")
  HTMLAsStringTemp = Right$(HTMLAsString, Len(HTMLAsString) - _
    (i + 3))
  j = InStr(1, HTMLAsStringTemp, "</b>")
  StockQuoteInfo = "$ " & Trim(Mid$(HTMLAsStringTemp, 1, j - 1))
  
  lblTime.Caption = StockQuoteTime
  lblQuote.Caption = StockQuoteInfo
    
  Exit Sub

HandleBadHTMLError:
  Print "Error: bad HTML"
  Exit Sub
  
HandleAsyncReadError:
  Print "Error: ", Err.Description
  Exit Sub
  
HandleBadStockSymbol:
  Print "Unknown stock symbol: " + m_StockSymbol
End Sub