关于枚举所有子窗口问题
我程序中的代码如下:
程序代码: public delegate bool EnumChildProc(IntPtr hwnd, IntPtr lParam);
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll", EntryPoint = "EnumChildWindows")]
public static extern bool EnumChildWindows(IntPtr hwndParent, EnumChildProc EnumFunc, IntPtr lParam);
bool EnumCP(IntPtr hwnd, IntPtr lParam)
{
if (GetWindowLong(hwnd, -16) == 56010000)
{
return false;
}
return true;
}调用时(chwnd是父窗口的句柄):
EnumChildWindows(chwnd, EnumCP, IntPtr.Zero)
问题是子窗口有3个,但只枚举了第一个窗口就停止了,第一个是返回true的,请教大家是什么原因呢?




