home *** CD-ROM | disk | FTP | other *** search
- '--------------------------------------------------------------------------
- ' EnumTopMost.vbs - Enumerates all visible top most windows and prints
- ' window list to the standard output (when using CSCRIPT)
- '
- ' This file is part of the sgWindow.
- ' Copyright (C) 1998 Stinga
- ' All rights reserved.
- '
- ' This sample demonstrates usage of the sgWindow component
- ' and it's window enumeration capabilities.
- '--------------------------------------------------------------------------
- option explicit
-
-
- const ws_OVERLAPPED = &H00000000
- const ws_POPUP = &H80000000
- const ws_CHILD = &H40000000
- const ws_MINIMIZE = &H20000000
- const ws_VISIBLE = &H10000000
- const ws_DISABLED = &H08000000
- const ws_CLIPSIBLINGS = &H04000000
- const ws_CLIPCHILDREN = &H02000000
- const ws_MAXIMIZE = &H01000000
- const ws_CAPTION = &H00C00000
- const ws_BORDER = &H00800000
- const ws_DLGFRAME = &H00400000
- const ws_VSCROLL = &H00200000
- const ws_HSCROLL = &H00100000
- const ws_SYSMENU = &H00080000
- const ws_THICKFRAME = &H00040000
- const ws_GROUP = &H00020000
- const ws_TABSTOP = &H00010000
- const ws_MINIMIZEBOX = &H00020000
- const ws_MAXIMIZEBOX = &H00010000
- const ws_TILED = &H00000000
- const ws_ICONIC = &H20000000
- const ws_SIZEBOX = &H00040000
- const ws_OVERLAPPEDWINDOW = &H00CF0000
- const ws_POPUPWINDOW = &H80880000
- const ws_CHILDWINDOW = &H40000000
- const ws_TILEDWINDOW = &H00CF0000
-
- dim vbCrLf
- vbCrLf = Chr(13) + Chr(10)
-
- ' --- Collect window list
- Dim sList
- sList = GetTopMostList()
-
- WScript.Echo sList
- WScript.Echo "This list was generated with Stinga sgWindow component." + vbCrLf + "Copyright (C) 1998 Stinga"
-
- WScript.Quit
-
- Private Function GetTopMostList()
-
- ' --- Create window object
- dim g, wnd, wndChild
- Set g = CreateObject("SGWindow.Globals")
- Set wnd = g.DesktopWindow
-
- Dim style
- style = ws_OVERLAPPEDWINDOW Or ws_VISIBLE
- For Each wndChild In wnd.Children
- if (wndChild.Style And style) = style then
- GetTopMostList = GetTopMostList + wndChild.Class + " - '" _
- + wndChild.Text _
- + vbCrLf
- '+ "' (" + Hex(wndChild.HWND) _
- '+ " - " + Hex(wndChild.Style) + ")" _
- end if
- Next
- End Function
-
-