public static List <IntPtr> GetChildWindows(IntPtr parent) { List <IntPtr> numList = new List <IntPtr>(); GCHandle gcHandle = GCHandle.Alloc((object)numList); try { WindowsAPI.EnumWindowsProc lpEnumFunc = new WindowsAPI.EnumWindowsProc(WindowsAPI.EnumWindow); WindowsAPI.EnumChildWindows(parent, lpEnumFunc, GCHandle.ToIntPtr(gcHandle)); } finally { if (gcHandle.IsAllocated) { gcHandle.Free(); } } return(numList); }
private static extern bool EnumChildWindows( IntPtr hwndParent, WindowsAPI.EnumWindowsProc lpEnumFunc, IntPtr lParam);
public static extern int EnumWindows(WindowsAPI.EnumWindowsProc ewp, int lParam);