EnumChildWindows

EnumChildWindows

   函数功能:枚举一个父窗口的所有子窗口。

  函数原型:BOOL EnumChildWindows(HWND hWndParent,WNDENUMPROC lpEnumFunc, LPARAM lParam);

      参数说明

  HWND hWndParent,                    // handle to parent window        // 父窗口句柄

  WNDENUMPROC lpEnumFunc,     // callback function                  // 回调函数的地址

      LPARAM lParam                         // application-defined value        // 你自已定义的参数 

注意:

1、这个回调函数要么是类的静态函数,要么就是一个全局的函数。

2、在调用EnumChildWindows 时,直到调用到最后以一个子窗口被枚举或回调函数返回一个false,否则将一直枚举下去。

3、子窗口下属的子窗口也可由EnumChildWindows 枚举

EnumChildWindows Function


The EnumChildWindows function enumerates the child windows that belong to the specified parent window by passing the handle to each child window, in turn, to an application-defined callback function. EnumChildWindows continues until the last child window is enumerated or the callback function returns FALSE.

Syntax

BOOL EnumChildWindows(          HWND hWndParent,
    WNDENUMPROC lpEnumFunc,
    LPARAM lParam
);Parameters

hWndParent
[in] Handle to the parent window whose child windows are to be enumerated. If this parameter is NULL, this function is equivalent to EnumWindows.
Windows 95/98/Me: hWndParent cannot be NULL.

lpEnumFunc
[in] Pointer to an application-defined callback function. For more information, see EnumChildProc.


lParam
[in] Specifies an application-defined value to be passed to the callback function.
Return Value

Remarks

If a child window has created child windows of its own, EnumChildWindows enumerates those windows as well.

A child window that is moved or repositioned in the Z order during the enumeration process will be properly enumerated. The function does not enumerate a child window that is destroyed before being enumerated or that is created during the enumeration process.

Example

For an example see Destroying a Window.

posted @ 2013-07-12 09:47  FREE小宝  阅读(1312)  评论(0编辑  收藏  举报