The EnumThreadWindows function enumerates all nonchild windows associated with a thread by passing the handle of each window, in turn, to an application-defined callback function. EnumThreadWindows continues until the last window is enumerated or the callback function returns FALSE. To enumerate child windows of a particular window, use the EnumChildWindows function.
BOOL EnumThreadWindows(
DWORD dwThreadId,
// thread identifier
WNDENUMPROC lpfn,
// pointer to callback function
LPARAM lParam
// application-defined value
);
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
EnumChildWindows, EnumThreadWndProc, EnumWindows
.