Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Include "WIN32API.INC"
Global wList$
'// To determine if a hwnd is visible:
'IF IsWindowVisible(hWnd) = 1 THEN 'Window is visible
'// To determine the Process ID of a window:
'IF GetWindowThreadProcessId(hWnd,lProc) THEN MSGBOX "Process ID=" & STR$(lProc)
Function ParentCallback (ByVal hWndChild As Long, lRaram As Long) As Long
DIM szClass As AsciiZ * %MAX_PATH
DIM szText As AsciiZ * %MAX_PATH
DIM lRes As Long
lRes = GetClassName(hWndChild, szClass, SIZEOF(szClass))
lRes = GetWindowText(hWndChild, szText, SIZEOF(szText))
wList$ = wList$ + $crlf + " Child: Class=" & szClass & " " & "Text=" & szText
lRes = EnumChildWindows(hWndChild, CODEPTR(ChildCallback), 0&)
Function = 1
End Function
Function ChildCallback (ByVal hWndChild As Long, lRaram As Long) As Long
DIM szClass As AsciiZ * %MAX_PATH
DIM szText As AsciiZ * %MAX_PATH
DIM lRes As Long
lRes = GetClassName(hWndChild, szClass, SIZEOF(szClass))
lRes = GetWindowText(hWndChild, szText, SIZEOF(szText))
wList$ = wList$ + $crlf + "PARENT: Class=" & szClass & " " & "Text=" & szText
Function = 1
End Function
Function PBMain As Long
ON ERROR RESUME NEXT
temp$ = "Enumerating all parent and child windows..."
DIM bResult As Long
bResult = EnumChildWindows(GetDesktopWindow, CODEPTR(ParentCallback), 0&)
? temp$
End Function
'gbs_01090
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm