home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD99699192000.psc / source / Form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-08-15  |  23.4 KB  |  697 lines

  1. VERSION 5.00
  2. Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.dll"
  3. Begin VB.Form frmMain 
  4.    ClientHeight    =   5595
  5.    ClientLeft      =   165
  6.    ClientTop       =   450
  7.    ClientWidth     =   7305
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   5595
  10.    ScaleWidth      =   7305
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.PictureBox border 
  13.       Appearance      =   0  'Flat
  14.       BackColor       =   &H8000000A&
  15.       BorderStyle     =   0  'None
  16.       ForeColor       =   &H80000008&
  17.       Height          =   375
  18.       Index           =   1
  19.       Left            =   720
  20.       MousePointer    =   7  'Size N S
  21.       ScaleHeight     =   375
  22.       ScaleWidth      =   735
  23.       TabIndex        =   2
  24.       Top             =   480
  25.       Width           =   735
  26.    End
  27.    Begin SHDocVwCtl.WebBrowser wb 
  28.       Height          =   495
  29.       Index           =   0
  30.       Left            =   480
  31.       TabIndex        =   1
  32.       Top             =   1560
  33.       Width           =   2055
  34.       ExtentX         =   3625
  35.       ExtentY         =   873
  36.       ViewMode        =   0
  37.       Offline         =   0
  38.       Silent          =   0
  39.       RegisterAsBrowser=   0
  40.       RegisterAsDropTarget=   1
  41.       AutoArrange     =   0   'False
  42.       NoClientEdge    =   0   'False
  43.       AlignLeft       =   0   'False
  44.       NoWebView       =   0   'False
  45.       HideFileNames   =   0   'False
  46.       SingleClick     =   0   'False
  47.       SingleSelection =   0   'False
  48.       NoFolders       =   0   'False
  49.       Transparent     =   0   'False
  50.       ViewID          =   "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
  51.       Location        =   "http:///"
  52.    End
  53.    Begin VB.PictureBox border 
  54.       Appearance      =   0  'Flat
  55.       BackColor       =   &H8000000A&
  56.       BorderStyle     =   0  'None
  57.       ForeColor       =   &H80000008&
  58.       Height          =   375
  59.       Index           =   0
  60.       Left            =   3000
  61.       MousePointer    =   7  'Size N S
  62.       ScaleHeight     =   375
  63.       ScaleWidth      =   735
  64.       TabIndex        =   0
  65.       Top             =   2040
  66.       Width           =   735
  67.    End
  68.    Begin SHDocVwCtl.WebBrowser wb 
  69.       Height          =   495
  70.       Index           =   1
  71.       Left            =   2640
  72.       TabIndex        =   3
  73.       Top             =   0
  74.       Width           =   2055
  75.       ExtentX         =   3625
  76.       ExtentY         =   873
  77.       ViewMode        =   0
  78.       Offline         =   0
  79.       Silent          =   0
  80.       RegisterAsBrowser=   0
  81.       RegisterAsDropTarget=   1
  82.       AutoArrange     =   0   'False
  83.       NoClientEdge    =   0   'False
  84.       AlignLeft       =   0   'False
  85.       NoWebView       =   0   'False
  86.       HideFileNames   =   0   'False
  87.       SingleClick     =   0   'False
  88.       SingleSelection =   0   'False
  89.       NoFolders       =   0   'False
  90.       Transparent     =   0   'False
  91.       ViewID          =   "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
  92.       Location        =   "http:///"
  93.    End
  94.    Begin SHDocVwCtl.WebBrowser wb 
  95.       Height          =   495
  96.       Index           =   2
  97.       Left            =   2400
  98.       TabIndex        =   4
  99.       Top             =   840
  100.       Width           =   2055
  101.       ExtentX         =   3625
  102.       ExtentY         =   873
  103.       ViewMode        =   0
  104.       Offline         =   0
  105.       Silent          =   0
  106.       RegisterAsBrowser=   0
  107.       RegisterAsDropTarget=   1
  108.       AutoArrange     =   0   'False
  109.       NoClientEdge    =   0   'False
  110.       AlignLeft       =   0   'False
  111.       NoWebView       =   0   'False
  112.       HideFileNames   =   0   'False
  113.       SingleClick     =   0   'False
  114.       SingleSelection =   0   'False
  115.       NoFolders       =   0   'False
  116.       Transparent     =   0   'False
  117.       ViewID          =   "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
  118.       Location        =   "http:///"
  119.    End
  120.    Begin VB.Menu mnuParent 
  121.       Caption         =   "parent"
  122.       Visible         =   0   'False
  123.       Begin VB.Menu mnuChild 
  124.          Caption         =   "-"
  125.          Index           =   0
  126.       End
  127.    End
  128.    Begin VB.Menu mnuNewWindow 
  129.       Caption         =   "newwindow"
  130.       Visible         =   0   'False
  131.    End
  132.    Begin VB.Menu mnusrc 
  133.       Caption         =   "src"
  134.       Visible         =   0   'False
  135.    End
  136. Attribute VB_Name = "frmMain"
  137. Attribute VB_GlobalNameSpace = False
  138. Attribute VB_Creatable = False
  139. Attribute VB_PredeclaredId = True
  140. Attribute VB_Exposed = False
  141. Private thewn As CWordNetYasu
  142. Const ccIncrement = 50000 '==========================================
  143. Private wbctrl_top_min_height
  144. Private wbctrl_bottom_min_height
  145. Private Const default_wbctrl_top_height = 800
  146. Private Const default_wbctrl_bottom_height = 300
  147. Dim ccoffset As Long
  148. Dim ccoffset2 As Long
  149. Dim ccoffset3 As Long
  150. Private wbctrl_top_height
  151. Private wbctrl_bottom_height
  152. Private Dragging As Boolean
  153. Private oldy
  154. Public curword
  155. Private dict_loading As Boolean
  156. Public local_mode As Boolean
  157. Public external_resource_dir As String
  158. Public curword_found As Boolean
  159. Public main_document_complete As Boolean
  160. Public indexdir As String
  161. Dim WithEvents htmldoc1 As MSHTML.HTMLDocument
  162. Attribute htmldoc1.VB_VarHelpID = -1
  163. Dim WithEvents htmldoc2 As MSHTML.HTMLDocument
  164. Attribute htmldoc2.VB_VarHelpID = -1
  165. Dim WithEvents htmldoc3 As MSHTML.HTMLDocument
  166. Attribute htmldoc3.VB_VarHelpID = -1
  167. Dim WithEvents htmldoc4 As MSHTML.HTMLDocument
  168. Attribute htmldoc4.VB_VarHelpID = -1
  169. Dim WithEvents htmldoc5 As MSHTML.HTMLDocument
  170. Attribute htmldoc5.VB_VarHelpID = -1
  171. Dim WithEvents htmldoc6 As MSHTML.HTMLDocument
  172. Attribute htmldoc6.VB_VarHelpID = -1
  173. Dim WithEvents htmldoc7 As MSHTML.HTMLDocument
  174. Attribute htmldoc7.VB_VarHelpID = -1
  175. Dim WithEvents htmldoc8 As MSHTML.HTMLDocument
  176. Attribute htmldoc8.VB_VarHelpID = -1
  177. Dim WithEvents htmldoc9 As MSHTML.HTMLDocument
  178. Attribute htmldoc9.VB_VarHelpID = -1
  179.          Const ConcatStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  180.          Private Declare Function GetTickCount Lib "kernel32" () As Long
  181. Private Sub ArrangeControls()
  182. 'Dim x As InternetExplorer
  183. 'On Error GoTo ErrorHandler
  184. border_thickness = 100
  185. infrm_top = 0
  186. infrm_left = 0
  187. infrm_width = Me.ScaleWidth
  188. infrm_height = Me.ScaleHeight
  189. If wbctrl_top_height < wbctrl_top_min_height Then
  190.     wbctrl_top_height = wbctrl_top_min_height
  191. End If
  192. If wbctrl_bottom_height < wbctrl_bottom_min_height Then wbctrl_bottom_height = wbctrl_bottom_min_height
  193. wbctrl_middle_height = infrm_height - wbctrl_top_height - wbctrl_bottom_height - 2 * border_thickness
  194. 'Debug.Print wbctrl_middle_height
  195. If wbctrl_middle_height <= 0 Then
  196.     'OOOPS  THERE'S NO SPACE FOR THE MAIN WINDOW
  197.     wbctrl_middle_height = 0
  198.     remaining_window_height = infrm_height - 2 * border_thickness
  199.     If remaining_window_height <= 0 Then
  200.         'DOOMED.  CAN'T DRAW ANYTHING
  201.         Debug.Print "doomed"
  202.         Exit Sub
  203.     Else
  204.     'OK.  DIVIDE UP THE REMAININGS
  205.         wbctrl_top_height = remaining_window_height * wbctrl_top_height / (wbctrl_top_height + wbctrl_bottom_height)
  206.         wbctrl_bottom_height = remaining_window_height - wbctrl_top_height
  207.         Debug.Print "divided"
  208.     End If
  209. End If
  210. first_loop = True
  211. For Each wbctrl In wb
  212.     wbctrl.Width = infrm_width '- 2 * Screen.TwipsPerPixelX
  213.     wbctrl.Left = infrm_left '+ 2 * Screen.TwipsPerPixelX
  214. For Each bdctrl In border
  215.     bdctrl.Width = infrm_width
  216.     bdctrl.Left = infrm_left
  217.     bdctrl.Height = border_thickness
  218. wb(0).Top = infrm_top
  219. wb(0).Height = wbctrl_top_height
  220. nextwindowpos = wb(0).Top + wb(0).Height
  221. border(0).Top = nextwindowpos
  222. If wbctrl_middle_height > 0 Then
  223.     'wb(1).Visible = True
  224.     wb(1).Top = nextwindowpos + border_thickness
  225.     wb(1).Height = wbctrl_middle_height
  226.     nextwindowpos = wb(1).Top + wb(1).Height
  227.     'wb(1).Visible = True
  228.     nextwindowpos = nextwindowpos + border_thickness
  229.         wb(1).Top = nextwindowpos
  230. End If
  231. border(1).Top = nextwindowpos
  232. wb(2).Top = nextwindowpos + border_thickness
  233. wb(2).Height = wbctrl_bottom_height
  234. ErrorHandler:
  235. End Sub
  236. Private Sub border_DblClick(index As Integer)
  237. Select Case index
  238. Case 0
  239.     If wbctrl_top_height = 0 Then
  240.         wbctrl_top_height = default_wbctrl_top_height
  241.     Else
  242.         wbctrl_top_height = 0
  243.     End If
  244. Case 1
  245.     If wbctrl_bottom_height = 0 Then
  246.         wbctrl_bottom_height = default_wbctrl_bottom_height
  247.     Else
  248.         wbctrl_bottom_height = 0
  249.     End If
  250. End Select
  251. ArrangeControls
  252. End Sub
  253. Private Sub border_MouseDown(index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  254. Dragging = True
  255. oldy = 0
  256. End Sub
  257. Private Sub border_MouseMove(index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  258.     If Not Dragging Then Exit Sub
  259.       
  260.     If oldy = 0 Then
  261.         'Debug.Print "========"
  262.         oldy = y
  263.     Else
  264.         If index = 0 Then
  265.             
  266.                 wbctrl_top_height = y - oldy + wbctrl_top_height
  267.                 'Debug.Print wbctrl_top_height
  268.         ElseIf index = 1 Then
  269.             wbctrl_bottom_height = wbctrl_bottom_height - (y - oldy)
  270.         End If
  271.     End If
  272.      
  273. ArrangeControls
  274. End Sub
  275. Private Sub border_MouseUp(index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  276. Dragging = False
  277. End Sub
  278. Private Sub Command1_Click()
  279.     For i = 1000 To 3000
  280.         wbctrl_top_height = i
  281.         ArrangeControls
  282.         
  283.     Next i
  284. End Sub
  285. Private Sub Form_Load()
  286. external_resource_dir = "http://www.yasuaki.com/eetp/external/"
  287. local_mode = False
  288. indexdir = "C:\WN16\DICT"
  289. main_document_complete = False
  290. curword_found = False
  291. wb(0).Navigate2 external_resource_dir & "html/navigation.htm"
  292. wb(1).Navigate2 ("about:blank")
  293. 'wb(2).Navigate2 ("about:blank")
  294. wb(2).Navigate2 external_resource_dir & "html/blankframe.htm"
  295. wbctrl_top_height = default_wbctrl_top_height
  296. wbctrl_bottom_height = default_wbctrl_bottom_height
  297. If local_mode = True Then
  298.     Set thewn = New CWordNetYasu
  299.     thewn.Construct (indexdir)
  300. End If
  301. 'hHook = SetWindowsHookEx(2, AddressOf Keyboard, App.hInstance, 0)
  302. ChrTrap = vbKeyF10
  303. 'wb(0).Navigate2 "http://microsoft.com"
  304. Debug.Print App.Path + "\webnavigation\index.htm"
  305. Dim MyFile, MyPath, MyName
  306. ArrangeControls
  307. End Sub
  308. Public Function statustext(txt As String)
  309. On Error Resume Next
  310. 'wb(2).Document.frames(0).Document.body.innerText = txt
  311. End Function
  312. Private Sub Form_Unload(Cancel As Integer)
  313. If local_mode Then
  314.     thewn.Destruct
  315. End If
  316. End Sub
  317. Private Sub Form_Resize()
  318. ArrangeControls
  319. End Sub
  320. Private Function htmldoc1_oncontextmenu() As Boolean
  321.     htmldoc_oncontextmenu
  322. End Function
  323. Private Function htmldoc2_oncontextmenu() As Boolean
  324.     htmldoc_oncontextmenu
  325. End Function
  326. Private Function htmldoc3_oncontextmenu() As Boolean
  327.     htmldoc_oncontextmenu
  328. End Function
  329. Private Function htmldoc4_oncontextmenu() As Boolean
  330.     htmldoc_oncontextmenu
  331. End Function
  332. Private Function htmldoc5_oncontextmenu() As Boolean
  333.     htmldoc_oncontextmenu
  334. End Function
  335. Private Function htmldoc6_oncontextmenu() As Boolean
  336.     htmldoc_oncontextmenu
  337. End Function
  338. Private Function htmldoc7_oncontextmenu() As Boolean
  339.     htmldoc_oncontextmenu
  340. End Function
  341. Private Function htmldoc8_oncontextmenu() As Boolean
  342.     htmldoc_oncontextmenu
  343. End Function
  344. Private Function htmldoc9_oncontextmenu() As Boolean
  345.     htmldoc_oncontextmenu
  346. End Function
  347. Private Function htmldoc_oncontextmenu() As Boolean
  348.     Debug.Print "IDocHostUIHandler_ShowContextMenu"
  349.     If Me.main_document_complete = True Then
  350.         Dim NewPopup As New frmPopup
  351.         Dim XY As POINTAPI
  352.         GetCursorPos XY
  353.         NewPopup.PopupNow Me, XY.x, XY.y
  354.     Else
  355.         statustext "document not finished loading"
  356.     End If
  357. End Function
  358. Private Sub mnuNewWindow_Click()
  359. On Error Resume Next
  360. Dim frmWB As frmMain
  361. Set frmWB = New frmMain
  362. frmWB.wb(1).RegisterAsBrowser = True
  363. frmWB.Visible = True
  364. End Sub
  365. Private Sub mnusrc_Click()
  366.     wb(2).Document.frames(0).Document.body.innerText = wb(1).Document.body.outerHTML
  367. End Sub
  368. Private Sub wb_DocumentComplete(index As Integer, ByVal pDisp As Object, URL As Variant)
  369. If index <> 1 Then Exit Sub
  370. main_document_complete = True
  371. If wb(1).Document.frames.length = 0 Then
  372. Set htmldoc1 = wb(1).Document
  373. RecurseFrames wb(1).Document
  374. On Error Resume Next
  375.     Set htmldoc1 = wb(1).Document.frames(0).Document
  376.     RecurseFrames htmldoc1
  377.     Set htmldoc2 = wb(1).Document.frames(1).Document
  378.     RecurseFrames htmldoc2
  379.     Set htmldoc3 = wb(1).Document.frames(2).Document
  380.     RecurseFrames htmldoc3
  381.     Set htmldoc4 = wb(1).Document.frames(3).Document
  382.     Set htmldoc5 = wb(1).Document.frames(4).Document
  383.     Set htmldoc6 = wb(1).Document.frames(5).Document
  384.     Set htmldoc7 = wb(1).Document.frames(6).Document
  385.     Set htmldoc8 = wb(1).Document.frames(7).Document
  386.     Set htmldoc9 = wb(1).Document.frames(8).Document
  387. On Error GoTo 0
  388. End If
  389.  'wb(2).Document.frames(0).Document.body.innerText = r
  390. End Sub
  391. Private Sub RecurseFrames(ByVal iDoc As HTMLDocument)
  392.     Dim Frame As HTMLFrameElement
  393.     Dim Range As IHTMLTxtRange
  394.     Dim Title As String
  395.     Dim TextInfo As String
  396.     On Error Resume Next
  397.     Title = iDoc.Title
  398.     If Title = "" Then
  399.         Title = iDoc.parentWindow.Name
  400.     End If
  401.     Dim i As Long
  402.     If inode Is Nothing Then
  403.         'if this is the first time, add a root node
  404.         Set tvNode = tvTreeView.Nodes.Add(, , , Title)
  405.         tvNode.Expanded = True
  406.         'Set iNode = tvTreeView.Nodes.Add(, , , Title)
  407.         'Debug.Print iNode
  408.     Else
  409.         Set tvNode = tvTreeView.Nodes.Add(inode.index, tvwChild, , Title)
  410.     End If
  411.     TextInfo = "Title: " & Title & " {" + vbCrLf
  412.     'check to see if the document has a BODY
  413.     If iDoc.body.tagName = "BODY" Then
  414.         'fill the tree with following collections
  415.         
  416.         
  417.         FillTree2 iDoc, "OBJECT"
  418.         'use the text range object to get text out of BODY
  419.         Set Range = iDoc.body.createTextRange
  420.         TextInfo = TextInfo & Range.Text & vbCrLf
  421.         Set Range = Nothing
  422.     End If
  423.     txtText.Text = txtText.Text & TextInfo & "}" & vbCrLf
  424.     'recurse all the frames
  425.     For Each Frame In iDoc.frames
  426.         RecurseFrames Frame.Document
  427.     Next
  428. End Sub
  429. Private Sub FillTree2(iDoc As HTMLDocument, iMatchTag As String)
  430.     Dim Element As Object
  431.     Dim Info As String
  432.     Dim testa As HTMLBody
  433.     On Error Resume Next
  434.              Dim c As New Collection
  435.             c.Add "beforeBegin"
  436.             c.Add "afterBegin"
  437.             c.Add "beforeEnd"
  438.             c.Add "afterEnd"
  439.     For Each Element In iDoc.All
  440.                 Set testa = Element
  441.                  Dim i As Long
  442.                 Dim s As String
  443.     If False Then
  444.         thetagname = testa.tagName
  445.         r = InStr(1, LCase(thetagname), "body")
  446.         
  447.         If r = Null Then r = 0
  448.         If r <> 0 Then
  449.             'testa.innerHTML =  & testa.innerHTML
  450.         End If
  451.     End If
  452.        ' var nod=document.createElement("B");
  453.        ' document.body.insertBefore(nod);
  454.        ' nod.innerText = "A New bold object has been"
  455.        '             inserted into the document."
  456.     '}
  457.               
  458.      
  459.      
  460.      
  461.      
  462.                              Dim testc As HTMLBody
  463.                         Set testc = Element
  464.                    '     Debug.Print testa.toString
  465.                   '     Debug.Print testc.toString
  466.                        
  467.                        If testc.hasChildNodes = True Then
  468.                       'Debug.Print testc.childNodes.length
  469.                        End If
  470.                        
  471.                 For i = 1 To 3 Step 2
  472.                     
  473.                     
  474.                     s = ""
  475.                      s = testa.getAdjacentText(c.Item(i))
  476.                     's2 = testa.getAdjacentText(c.Item(i))
  477.                      testa.insertBefore (nod)
  478.                     '                      nod.innerText = "asdf"
  479.                     ' testa.Document.body.insertBefore (nod)
  480.                     'If s <> Empty Then testa.insertAdjacentText "x.item(i)", "("
  481.                     'Debug.Print testa.outerHTML
  482.                     If s <> Empty And Len(s) > 1 Then
  483.                         'Element.innerHTML = "<b>" & (Element.innerHTML) & "</b>"
  484.                         'testa.replaceAdjacentText c.Item(i), "[" + testa.getAdjacentText(c.Item(i)) + "]"
  485.                         Dim NewText As String
  486.                         NewText = spantext(testa.getAdjacentText(c.Item(i)))
  487.                         'Debug.Print newtext
  488.                         testa.replaceAdjacentText c.Item(i), ""
  489.                        testa.insertAdjacentHTML c.Item(i), NewText
  490.                         'wb(2).Document.body.innerText = wb(1).Document.body.outerHTML
  491.                        'Exit For
  492.                     End If
  493.                 Next
  494.                     
  495.         Next
  496. End Sub
  497. Private Sub wb_NewWindow2(index As Integer, ppDisp As Object, Cancel As Boolean)
  498. On Error Resume Next
  499. Dim frmWB As frmMain
  500. Set frmWB = New frmMain
  501. frmWB.wb(1).RegisterAsBrowser = True
  502. Set ppDisp = frmWB.wb(1).object
  503. frmWB.Visible = True
  504. End Sub
  505. Private Function navcmd(cmdtype, cmdstr)
  506. On Error Resume Next
  507. Select Case cmdtype
  508. Case "gourl"
  509.     'Debug.Print "url"
  510.     wb(1).Navigate2 (cmdstr)
  511. Case "cmd"
  512.     'Debug.Print "cmd"
  513.     Select Case cmdstr
  514.     Case "goforward"
  515.         wb(1).GoForward
  516.     Case "goback"
  517.         wb(1).GoBack
  518.     Case "home"
  519.         wb(1).Navigate ("http://www.yasuaki.com/eetp")
  520.     End Select
  521. Case "cw"
  522.     'Debug.Print cmdstr
  523.         curword_found = False
  524.         curword = LCase(cmdstr)
  525.         Me.Caption = "The cursor is over " + curword
  526.         Dim curword2 As String
  527.         curword2 = curword
  528.         If local_mode = True Then
  529.             swrite = ""
  530.             swrite = thewn.GetXMLIdx(curword2)
  531.         
  532.             If swrite <> "" Then
  533.                 curword_found = True
  534.                 fn = FreeFile
  535.                 Open external_resource_dir & "xml\idx.xml" For Output As fn
  536.                     swrite = thewn.GetXMLIdx(curword2)
  537.                     Print #fn, swrite
  538.                 Close fn
  539.                 'wb(2).Navigate App.Path & "\external\xml\idx.xml"
  540.             End If
  541.         End If
  542. End Select
  543. End Function
  544. Private Sub RecurseFrames2(ByVal iDoc As HTMLDocument)
  545.     Dim Frame As HTMLFrameElement
  546.     Dim Range As IHTMLTxtRange
  547.     Dim Title As String
  548.     Dim TextInfo As String
  549.     On Error Resume Next
  550.     Title = iDoc.Title
  551.     If Title = "" Then
  552.         Title = iDoc.parentWindow.Name
  553.     End If
  554.     Dim i As Long
  555.     If inode Is Nothing Then
  556.         'if this is the first time, add a root node
  557.         Set tvNode = tvTreeView.Nodes.Add(, , , Title)
  558.         tvNode.Expanded = True
  559.         'Set iNode = tvTreeView.Nodes.Add(, , , Title)
  560.         'Debug.Print iNode
  561.     Else
  562.         Set tvNode = tvTreeView.Nodes.Add(inode.index, tvwChild, , Title)
  563.     End If
  564.     TextInfo = "Title: " & Title & " {" + vbCrLf
  565.     'check to see if the document has a BODY
  566.     If iDoc.body.tagName = "BODY" Then
  567.         'fill the tree with following collections
  568.         
  569.         
  570.         FillTree2 iDoc, "OBJECT"
  571.         'use the text range object to get text out of BODY
  572.         Set Range = iDoc.body.createTextRange
  573.         TextInfo = TextInfo & Range.Text & vbCrLf
  574.         Set Range = Nothing
  575.     End If
  576.     txtText.Text = txtText.Text & TextInfo & "}" & vbCrLf
  577.     'recurse all the frames
  578.     For Each Frame In iDoc.frames
  579.         RecurseFrames Frame.Document
  580.     Next
  581. End Sub
  582. Private Sub walktags(otags, r)
  583.     'Dim otag As MSHTML.HTMLHtmlElement
  584.     On Error GoTo 0
  585.     Dim otag As HTMLHtmlElement
  586.     On Error Resume Next
  587.     For Each otag In otags
  588.         
  589.         If otag.childNodes.length > 1 Then
  590.             
  591.             
  592.             walktags otag.childNodes, r
  593.         Else
  594.         Debug.Print otag.childNodes.length, otag.tagName, otag.innerText
  595.             t = LCase(otag.tagName)
  596.             If LCase(otag.tagName) = "a" Then r = r & "[" & otag.tagName & ":" & otag.innerText & "]"
  597.             If t = "a" Then
  598.                 'Debug.Print otag.innerText
  599.                 'otag.innerText = UCase(otag.innerText)
  600.             End If
  601.         End If
  602.         
  603.     Next
  604. End Sub
  605. Private Function spantext(sorg) As String
  606.     Dim i As Long
  607.     Dim prevwhite As Boolean
  608.     Dim word As String
  609.     Dim startpos As Long
  610.     Dim whStartpos As Long
  611.     Dim newword As String
  612.         ccoffset = 0
  613.     prevwhite = True
  614.     For i = 1 To Len(sorg)
  615.         thechar = Mid$(sorg, i, 1)
  616.         isnormal = True
  617.         On Error GoTo conthere
  618.         
  619.         a = Asc(thechar)
  620.         If ((0 <= a And a < 65) Or (97 > a And a > 90) Or (255 >= a And a > 122)) Then
  621.         
  622.             isnormal = False
  623.         End If
  624.         
  625. conthere:
  626.         If isnormal = True Then
  627.             If prevwhite = True Then
  628.                 startpos = i
  629.             End If
  630.             prevwhite = False
  631.         Else
  632.             
  633.             If prevwhite = False Then
  634.         
  635.         newword = wordout(Mid$(sorg, startpos, i - startpos))
  636.          word = word + newword
  637.         '  word = Left$(word, ccoffset)
  638.                 
  639.                 'Debug.Print word
  640.             End If
  641.             'Concat word, "sdfa"
  642.           'word = Left$(word, ccoffset)
  643.             prevwhite = True
  644.             word = word + thechar
  645.         End If
  646.             
  647.     Next
  648.             If prevwhite = False Then
  649.         newword = wordout(Mid$(sorg, startpos, i - startpos))
  650.          word = word + newword
  651.             End If
  652. 'Debug.Print word
  653.     spantext = word
  654.     'Debug.Print word
  655. End Function
  656. Private Sub wb_StatusTextChange(index As Integer, ByVal Text As String)
  657.     colonstr = "_ee://"
  658.     colonpos = InStr(1, Text, colonstr, vbTextCompare)
  659.     colonlen = Len(colonstr)
  660.     If colonpos <> 0 Then
  661.         cmdtype = Left(Text, colonpos - 1)
  662.         cmdstr = Mid(Text, colonpos + colonlen)
  663.         navcmd cmdtype, cmdstr
  664.     Else
  665.         If index = 1 Then statustext (Text)
  666.     End If
  667. End Sub
  668. Private Function wordout(word As String) As String
  669.         
  670.         wordout = wordout + "<SPAN id=cw onmouseout=""window.status='cw_ee://';"" onmouseover =""window.status='cw_ee://"
  671.           
  672.         wordout = wordout + word
  673.         wordout = wordout + "';"">"
  674.        wordout = wordout + word
  675.           
  676.          wordout = wordout + "</SPAN>"
  677. End Function
  678. Private Sub wb_BeforeNavigate2(index As Integer, ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
  679. 'frmMain.Caption = URL & "processing text.  please wait..."
  680. main_document_complete = False
  681. On Error Resume Next
  682. If index = 1 Then
  683.     For i = 0 To wb(0).Document.frames(0).Document.All.length - 1
  684.         id_name = wb(0).Document.frames(0).Document.All(i).Id
  685.         If id_name = "txturl" Then
  686.             Dim otag As MSHTML.HTMLInputElement
  687.             Set otag = wb(0).Document.frames(0).Document.All(i)
  688.             otag.Value = URL
  689.         End If
  690.     Next
  691. End If
  692. 'sw(0).SetVariable "txturl", URL
  693. End Sub
  694. Private Sub sw_FSCommand(index As Integer, ByVal command As String, ByVal args As String)
  695.     navcmd command, args
  696. End Sub
  697.