home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Docking_To2050802282007.psc / DockTB / AllWindowsList.bas next >
BASIC Source File  |  2007-02-28  |  1KB  |  47 lines

  1. Attribute VB_Name = "AllWindowsList"
  2. ' ----------------------------------------------------------------- '
  3. ' Filename: AllWindowsList.bas
  4. ' Author:   Shaurya Malhotra (shauryamal@gmail.com)
  5. ' Date:     24 February 2007
  6. '
  7. ' Keeps track of all the windows in the application
  8. ' ----------------------------------------------------------------- '
  9.  
  10. Option Explicit
  11.  
  12. Private cAllWindows As New CCollection
  13.  
  14.  
  15. Public Function WindowExistsInList(hWnd As Long) As Object
  16.     Dim i As Long
  17.     i = cAllWindows.Size
  18.  
  19.     Do While (i > 0)
  20.         If cAllWindows.item(i).hWnd = hWnd Then
  21.             Set WindowExistsInList = cAllWindows.item(i)
  22.             Exit Function
  23.         End If
  24.         i = i - 1
  25.     Loop
  26. Set WindowExistsInList = Nothing
  27. End Function
  28.  
  29.  
  30. Public Function AddWindowInList(obj As Object)
  31.     Call cAllWindows.Insert(obj)
  32. End Function
  33.  
  34.  
  35. Public Function RemoveWindowInList(obj As Object)
  36.     Dim i As Long
  37.     i = cAllWindows.Size
  38.     
  39.     Do While (i > 0)
  40.         If (obj Is cAllWindows.item(i)) Then
  41.             cAllWindows.Remove (i)
  42.             Exit Function
  43.         End If
  44.         i = i - 1
  45.     Loop
  46. End Function
  47.