You'll find similar class and module name and functions as in Simple Reader for the speaking/agent part:
- class_agent.cls : contains the used microsoft agent functions (showing, hiding, speaking, right click handlers)
- class_ini_file.cls : class used for reading/writing options
- class_options.cls : class used to store options
- class_tts_engine.cls : class used to show/retrive allowed languages and tts engine
- form_config.frm : the options window code
- form_main.frm : the main window code
- globals.bas : contains global objects
- module_get_folder_name.bas : show and return the selected directory
And others specific for Internet Explorer event handlers :
- class_doc_event.cls : a MSHTML.HTMLDocument object onmouseover event handler (Retrive onmouseover event for a unique web page)
- class_col_doc_event.cls : collection of class_doc_event objects. (Can retrive onmoueover event for all web pages in the collection)
- class_ie_event.cls : SHDocVw.InternetExplorer object event handler (BeforeNavigate,DocumentComplete,NewWindow,OnQuit).
It's corrsponding to a unique IE window. Contains a class_col_doc_event object and handle its onmouseover events,
because a unique Internet Explorer can contain more than one html document like frame pages.
- class_col_ie_event.cls : collection of class_ie_event objects. Allow to handle multiple Internet Explorer windows/html documents onmouseover event.
- class_internet_explorer.cls : contains a class_col_ie_event object. Like this all events of each document/IE window are centralized in this object and get the same handler.
Check element names to be read and launch the agent speaking action.
- form_webpage_options.frm: the webpage options window code.
- class_internet_explorer_options.cls : options for the web page options window.
That's great but I'd like to use my own Browser using the WebBrowser control, How can I do ?
First add the classes class_doc_event and class_col_doc_event in your project. Don't forget to add a reference to MSHTML.TLB
(Project, References, Browse, and select MSHTML.TLB which is located to the c:\windows\system32\ directory)
Next add the following in your form containing the WebBrowser control:
- in declaration: Public WithEvents docs As class_col_doc_event
- in Form_Load event : Set docs = New class_col_doc_event 'constructor of the class
- in Form_Unload event : Set docs = Nothing ' destructor
- and at least the following code where WebBrowser1 is the WebBrowser control object putted on your form:
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, _
ByRef URL As Variant, _
ByRef Flags As Variant, _
ByRef TargetFrameName As Variant, _
ByRef PostData As Variant, _
ByRef Headers As Variant, _
ByRef Cancel As Boolean)
On Error Resume Next
docs.clear
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, ByRef URL As Variant)
On Error Resume Next
If pDisp.Document Is Nothing Then Exit Sub
If pDisp.Document.body.nodeName <> "FRAMESET" Then
docs.add pDisp.Document
End If
If pDisp Is iee.ie Then
End If
End Sub
Private Sub docs_onmouseover(objHTMLDocument As MSHTML.HTMLDocument)
On Error Resume Next
Dim tag_name As String
Dim text As String
tag_name = UCase$(objHTMLDocument.parentWindow.event.srcElement.tagName)
text = objHTMLDocument.parentWindow.event.srcElement.innerText
If text <> "" Then
End If
End Sub
|