下载本文示例代码
一个对话框有N个控件,怎样循环获得它们的RECT区域?假设控件的ID未知,N亦未知?我所知道的有GETDLGITEM(ID〕,但必须知道ID,可无法循环?
用API函数Enum
ChildWindows The EnumChildWindows function enumerates the child windows
that belong to the specified parent window by passing the handle of 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.
BOOL EnumChildWindows(
HWND hWndParent, // handle to parent window
WNDENUMPROC lpEnumFunc, // pointer to callback function
LPARAM lParam // application-defined value
);
Parameters
hWndParent
Identifies the parent window whose child windows
are to be enumerated.
lpEnumFunc
Points to an application-defined callback function.
For more information about the callback function,
see the EnumChildProc callback function.
lParam
Specifies a 32-bit, application-defined value to be
passed to the callback function.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
一个对话框有N个控件,怎样循环获得它们的RECT区域?假设控件的ID未知,N亦未知?我所知道的有GETDLGITEM(ID〕,但必须知道ID,可无法循环?
用API函数Enum
ChildWindows The EnumChildWindows function enumerates the child windows
that belong to the specified parent window by passing the handle of 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.
BOOL EnumChildWindows(
HWND hWndParent, // handle to parent window
WNDENUMPROC lpEnumFunc, // pointer to callback function
LPARAM lParam // application-defined value
);
Parameters
hWndParent
Identifies the parent window whose child windows
are to be enumerated.
lpEnumFunc
Points to an application-defined callback function.
For more information about the callback function,
see the EnumChildProc callback function.
lParam
Specifies a 32-bit, application-defined value to be
passed to the callback function.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
下载本文示例代码
循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT循环查询对话框上所有控件的RECT