Torna al Thread
Dim GotDocumentHandle As Boolean = False
Private Sub browser_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles browser.DocumentCompleted
If Not GotDocumentHandle Then
If Not Me.browser.Document Is Nothing Then
AddHandler browser.Document.Click, AddressOf DocClicked
GotDocumentHandle = True
End If
End If
End Sub
Public Sub DocClicked(ByVal sender As Object, ByVal e As HtmlElementEventArgs)
Dim elm As HtmlElement = Me.browser.Document.ActiveElement
' MsgBox(elm.ToString)
If elm.OuterHtml.ToUpper.StartsWith("<A ") Then
browser.Navigate(MyUrl)
End If
End Sub
Private Sub browser_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles browser.NewWindow
e.Cancel = True
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 8") //cancello i file emporanei
browser.Navigate(UrlDopoLogin)
End Sub