I'm using
To get a list of IE windows and I need to set some sort of attribute on each window so that I can identify them later in the program.Code:Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows
How?
Printable View
I'm using
To get a list of IE windows and I need to set some sort of attribute on each window so that I can identify them later in the program.Code:Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows
How?
Here's the code I'm using to connect to the IE windows:vb Code:
Dim objShell As Object Dim objShellWindows As Object Dim sWin As Object Dim x As Integer Dim winCount As Integer Dim dbgTime As Long Set objShell = CreateObject("Shell.Application") Set objShellWindows = objShell.Windows dbgTime = GetTickCount() For Each sWin In objShellWindows If Left$(sWin.Application.LocationURL, 4) = "http" Then Debug.Print sWin.Application.LocationURL winCount = winCount + 1 End If Next dbgTime = GetTickCount() - dbgTime If winCount = ieCount Then 'No new IE windows have been opened; exit Set objShell = Nothing Set objShellWindows = Nothing Exit Sub End If For Each sWin In objShellWindows If Left$(sWin.Application.LocationURL, 4) <> "http" Then GoTo NextWindow If sWin.Application.Tag <> "Captured" Then sWin.Application.Tag = "Captured" 'Code here for handling windows that haven't been seen before End If NextWindow: Next
Ok I managed to solve this problem myself.
In case anyone was wondering how to do it, I created a temporary InternetExplorer object (tmpIE) and then modified part of the code to this:Code:If tmpIE.GetProperty("Tag") <> "Captured" Then
tmpIE.PutProperty "Tag", "Captured"
...
End If