public static List <IntPtr> GetChildWindows(IntPtr parent) { List <IntPtr> list = new List <IntPtr>(); GCHandle value = GCHandle.Alloc(list); try { Win32Extendet.EnumWindowsProc lpEnumFunc = new Win32Extendet.EnumWindowsProc(Win32Extendet.GetChildWindowsCallback); Win32Extendet.EnumChildWindows(parent, lpEnumFunc, GCHandle.ToIntPtr(value)); } finally { if (value.IsAllocated) { value.Free(); } } return(list); }
public static bool EnumChildWindows(IntPtr hwndParent, Predicate <IntPtr> callback) { bool result = false; GCHandle value = GCHandle.Alloc(callback); try { Win32Extendet.EnumWindowsProc lpEnumFunc = new Win32Extendet.EnumWindowsProc(Win32Extendet.EnumChildWindowsCallback); Win32Extendet.EnumChildWindows(hwndParent, lpEnumFunc, GCHandle.ToIntPtr(value)); } finally { if (value.IsAllocated) { value.Free(); } } return(result); }
public static extern bool EnumChildWindows(IntPtr hwndParent, Win32Extendet.EnumWindowsProc lpEnumFunc, IntPtr lParam);