una volta feci un programmino che recuperava tutti gli indirizzi digitati dalle finestra IE aperte, restava in ascolto in background. Per gli eventi la dichiarazione del tuo oggetto IE dovresti farla con with events, e quindi essere in grado di gestirli.
Aggiungi un riferimento a Microsoft Internet Controls e Microsoft HTML Object Library, di seguito un piccolo esempio.
codice:
Dim SWs As SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer
Set SWs = New ShellWindows
For Each IE In SWs
If TypeOf IE.Document Is HTMLDocument Then
' es. recupera IE.LocationName
End If
Next
Set SWs = Nothing
Non ti serve altro, io controllavo qualsiasi applicazione aperta, se era ti tipo IE e mi interessava recuperavo l'handle, quindi:
codice:
Public Function IEDocument() As Object
Dim SWs As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer
Set IEDocument = Nothing
For Each IE In SWs
If IE.HWND = HWND Then
Set IEDocument = IE.Document
End If
Next
End Function
Public Function IEObject() As Object
Dim SWs As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer
Set IEObject = Nothing
For Each IE In SWs
If IE.HWND = HWND Then
Set IEObject = IE
End If
Next
End Function
a te questo non dovrebbe servire.