I need to capture the attributes of clicked elements in my application IE browser. All works fine and I am able to capture the attributes but the IE window gets unresponsive. i.e. if I click in the textbox the cursor will not be shown and mouse scroll will not work.
Imports System.Runtime.InteropServices
Imports mshtml
Public Class Form1
Dim WithEvents IE As New SHDocVw.InternetExplorer()
Dim WithEvents Doc As New mshtml.HTMLDocument
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Empty As Object = 0
Dim URL As Object = "file://D:/AtestWeb/index_Calls_popup.htm"
' override BeforeNavigate2 event
'IE.BeforeNavigate2 = New SHDocVw.DWebBrowserEvents2_BeforeNavigate2EventHandler(AddressOf e1.OnBeforeNavigate2)
IE.Visible = True
IE.Navigate(URL)
'IE.Navigate2(URL, Empty, Empty, Empty, Empty)
System.Threading.Thread.Sleep(5000)
End Sub
Private Sub IE_DocumentComplete(ByVal pDisp As Object, ByRef URL As Object) Handles IE.DocumentComplete
Doc = IE.Document
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CheckForIllegalCrossThreadCalls = False
End Sub
Private Sub Doc_onmouseup() Handles Doc.onmouseup
ListBox1.Items.Add(Doc.activeElement.innerText)
End Sub
End Class
If I remove mouse event everything works fine.
Thanks in advance for any help.