Visible Windows List [Windows]
Posted: Sat Aug 14, 2010 3:06 am
Code: Select all
Structure FindWindowData
hFW.l ; variable to store a handle
sFW.s ; variable to store a Window name
cFW.s ; variable to store a window class name
px.l
py.l
height.l
width.l
EndStructure
Global NewList FindWindow.FindWindowData()
Procedure.l EnumWindowsProc(hFind, lParam)
Protected WindowName.s = Space(255)
Protected WindowClass.s = Space(255)
Protected WP.WINDOWPLACEMENT
ClearStructure(@WP, WINDOWPLACEMENT)
WP\length = SizeOf(WINDOWPLACEMENT)
If GetWindowText_(hFind, WindowName, 255)
Result = GetClassName_(hFind, WindowClass, 255)
; If FindString(WindowClass, "WindowClass_", 0)
If GetWindowPlacement_(hFind, @WP)
If WP\showCmd=1 And IsWindowVisible_(hFind) And WindowClass<>"Button" And WindowClass<>"Progman"
AddElement(FindWindow())
FindWindow()\hFW = hFind
FindWindow()\sFW = WindowName
FindWindow()\cFW = WindowClass
FindWindow()\px = WP\rcNormalPosition\left
FindWindow()\py = WP\rcNormalPosition\top
FindWindow()\height = WP\rcNormalPosition\bottom-WP\rcNormalPosition\top-2*GetSystemMetrics_(#SM_CYFRAME)-GetSystemMetrics_(#SM_CYCAPTION)
FindWindow()\width = WP\rcNormalPosition\right-WP\rcNormalPosition\left-2*GetSystemMetrics_(#SM_CXFRAME)
EndIf
EndIf
; EndIf
EndIf
ProcedureReturn 1
EndProcedure
If EnumWindows_(@EnumWindowsProc(), 0)
CallDebugger
EndIf