BOOL EnumTaskWindows(htask, wndenmprc, lParam) | |||||
HTASK htask; | /* handle of task, */ | ||||
WNDENUMPROC wndenmprc; | /* address of callback function | */ | |||
LPARAM lParam; | /* application-defined value | */ |
The EnumTaskWindows function enumerates all windows associated with a given task. (A task is any program that executes as an independent unit. All applications are executed as tasks, and each instance of an application is a task.) The function enumerates the windows by passing their handles, one by one, to the specified callback function. EnumTaskWindows continues until the last entry is enumerated or the callback function returns zero.
htask
Identifies the task. The task handle must be retrieved by a previous call to the GetCurrentTask function.
wndenmprc
Specifies the procedure-instance address of the callback function. For more information, see the description of the EnumTaskWndProc callback function.
lParam
Specifies a 32-bit application-defined value that is passed to the callback function along with each window handle.
The return value is nonzero if the function is successful. Otherwise, it is zero.
This function enumerates all top-level windows but does not enumerate child windows.
The EnumTaskWindows function is reliable even when the application causes odd side effects, whereas an application that uses a GetWindow loop risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.
The address passed in the wndenmprc parameter must be created by using the MakeProcInstance function.