I need to get a list of child windows in Z-order. I'm currently using EnumChildWindows, but that doesn't seem to give me the results in sorted order.
My specific application is finding all top-level Internet Explorer or Netscape windows, in correct Z-order.
I'll give points for a good answer to any of the following questions:
1) A way to compare two sibling windows and determine which is higher up. Otherwise if I use FindWindow and there are both MSIE and NS windows open, I won't know which is the highest one.
2) Reassure me that GetWindow can be used in such a way that it won't go into an infinite loop (preferably without remembering lots of hwnd's that I've already seen, but if that's the ONLY way...) I don't care about hwnds that are killed halfway through.
3) A way for EnumChildWindows to give its results in sorted z-order.
4) Some other way...