EnumTaskWindows

Syntax

BOOL EnumTaskWindows(hTask,lpEnumFunc,lParam)

This function enumerates all windows associated with the hTask parameter, which is returned by the GetCurrentTask function. (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 enumeration terminates when the callback function, pointed to by lpEnumFunc, returns FALSE.

Parameter Type/Description  

hTask HANDLE Identifies the specified task. The GetCurrentTask function returns this handle.  
lpEnumFunc FARPROC Is the procedure-instance address of the window's callback function.  
lParam DWORD Specifies the 32-bit value that contains additional parameters that are sent to the callback function pointed to by lpEnumFunc.  

Return Value

The return value specifies the outcome of the function. It is nonzero if all the windows associated with a particular task are enumerated. Otherwise, it is zero.

Comments

The callback function must use the Pascal calling convention and must be declared FAR. The callback function must have the following form:

Callback Function

BOOL FAR PASCAL EnumFunc(hWnd, lParam)
HWND hWnd;
DWORD lParam;

EnumFunc is a placeholder for the application-supplied function name. The actual name must be exported by including it in an EXPORTS statement in the application's module-definition file.

Parameter Description  

hWnd Identifies a window associated with the current task.  
lParam Specifies the same argument that was passed to the EnumTaskWindows function.  

Return Value

The callback function can carry out any desired task. It must return a nonzero value to continue enumeration, or a zero value to stop it.