Enumerating the Frames

This utility doesn't cover frames. However, a routine like EnumerateFrames is not difficult to write. It will scan the document.frames collection, reading the src attribute for each item. Here's a possible implementation.

Private Sub EnumerateFrames(ByVal doc As HTMLDocument, ByVal list As ListBox)
On Error Resume Next
  Dim i As Integer

  For i = 0 To doc.frames.length - 1
     Add list, doc.frames.Item(i).src
  Next
End Sub

The object referenced through

doc.frames.Item(i).src

is an HTML file name corresponding to the file that is actually hosted in the given frame. The discussed architecture will recursively examine the internal files one by one. To add frames support to the utility, you just have to invoke such a procedure within the DoWalkElements subroutine.

Private Sub DoWalkElements(ByVal doc As HTMLDocument, ByVal list As ListBox)
  EnumerateImages doc, list
  EnumerateObjects doc, list
  EnumerateLinks doc, list
  EnumerateFrames doc, list
End Sub

© 1997 by Wrox Press. All rights reserved.