|
-
Apr 26th, 2007, 11:30 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Set identifier for object
I'm using
Code:
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows
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.
How?
Last edited by shirazamod; Apr 26th, 2007 at 11:42 AM.
-
Apr 26th, 2007, 10:14 PM
#2
Thread Starter
Fanatic Member
Re: Set identifier for object
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
-
Apr 27th, 2007, 07:13 AM
#3
Thread Starter
Fanatic Member
Re: Set identifier for object
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|