MSDN mentions the following remark for the GetWindow()
function.
The
EnumChildWindows
function is more reliable than callingGetWindow
in a loop. An application that callsGetWindow
to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.
Using EnumChildWindows
works just fine when only interested in listing all windows. However, what if you need the additional z-order functionality which GetWindow
provides? I can't find all windows ordered by z-order using EnumChildWindows
.
Does this mean there is no 'safe' way to do so?