Results 1 to 3 of 3

Thread: [RESOLVED] Set identifier for object

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Resolved [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.
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Set identifier for object

    Here's the code I'm using to connect to the IE windows:
    vb Code:
    1. Dim objShell As Object
    2. Dim objShellWindows As Object
    3. Dim sWin As Object
    4. Dim x As Integer
    5. Dim winCount As Integer
    6.  
    7. Dim dbgTime As Long
    8.  
    9. Set objShell = CreateObject("Shell.Application")
    10. Set objShellWindows = objShell.Windows
    11.    
    12. dbgTime = GetTickCount()
    13. For Each sWin In objShellWindows
    14.     If Left$(sWin.Application.LocationURL, 4) = "http" Then
    15.         Debug.Print sWin.Application.LocationURL
    16.         winCount = winCount + 1
    17.     End If
    18. Next
    19. dbgTime = GetTickCount() - dbgTime
    20. If winCount = ieCount Then
    21.     'No new IE windows have been opened; exit
    22.     Set objShell = Nothing
    23.     Set objShellWindows = Nothing
    24.     Exit Sub
    25. End If
    26.  
    27. For Each sWin In objShellWindows
    28.     If Left$(sWin.Application.LocationURL, 4) <> "http" Then GoTo NextWindow
    29.    
    30.     If sWin.Application.Tag <> "Captured" Then
    31.         sWin.Application.Tag = "Captured"
    32.             'Code here for handling windows that haven't been seen before
    33.     End If
    34.    
    35. NextWindow:
    36. Next
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    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
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width