Getting list of child windows?

Windows specific forum
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Getting list of child windows?

Post by jassing »

I have a container, that contains an object, with it's own handle.
IF the child handle is unknown, is there a way to get the container's list of child windows?
thanks.

-j
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Getting list of child windows?

Post by netmaestro »

Code: Select all

Structure Windowstuff
  text.s
  classname.s
  hwnd.l
  ctrlID.l
EndStructure

Global NewList windowstuff.Windowstuff()

Procedure EnumChildProc(hwnd, lParam)
  Protected classname$ = Space(#MAX_PATH)
  Protected windowname$ = Space(#MAX_PATH)
  
  AddElement(windowstuff())
  With windowstuff()
    GetClassName_(hwnd, @classname$, #MAX_PATH-1) : \classname = classname$
    GetWindowText_(hwnd, @windowname$, #MAX_PATH-1) : \text = windowname$
    \hwnd = hwnd
    \ctrlID = GetDlgCtrlID_(hwnd)
  EndWith
  
  ProcedureReturn #True
EndProcedure

EnumChildWindows_(hwndParent, @EnumChildProc(), 0)

ForEach windowstuff()
  Debug windowstuff()\text
  Debug windowstuff()\classname
  Debug windowstuff()\hwnd
  Debug windowstuff()\ctrlID
Next
Use GadgetID(<container>) in place of hwndParent and bob's your uncle.
BERESHEIT
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Getting list of child windows?

Post by jassing »

T*H*A*N*K Y*O*U !!!!!
Post Reply