Reputation: 5
I'm searching if it possible to check if some website for e.g. google.com is opened in IE. I have already this code but it was only for checking if IE is open and to close it, But it's not working.
Dim processCollection() As Process
processCollection = Process.GetProcessesByName("iexplore.exe")
If processCollection.Count > 0 Then
For Each process As Process In processCollection
process.Dispose()
Next
Return False
Else
MessageBox.Show("Ie is now close", "IE")
End If
Thanks for helping
Upvotes: 0
Views: 991
Reputation: 5
Function InternetExplorerRunning()
For Each ie As InternetExplorer In New ShellWindows()
Dim OpenWebsite As String
OpenWebsite = ie
If OpenWebsite = "google.com" Then
MsgBox("Google is open")
End If
Next
End Function
This code is in a timer.
Upvotes: 0
Reputation: 1486
Follow these steps
Now in property explorer of SHDocVw change Embedded InterOp types to false
Save , Clean and Rebuild the project.
Use below piece of code
For Each ie As InternetExplorer In New ShellWindows()
Console.WriteLine(ie.LocationURL())
Next
Upvotes: 2