public static List <IntPtr> GetChildWindows(this IntPtr hWnd) { var result = new User32Api.EnumCallBackModel { Hwnds = new List <IntPtr>() }; User32Api.EnumChildWindows(hWnd, ChildWindowEnumCallBack, ref result); return(result.Hwnds); }
/// <summary> /// 子窗口回调处理函数 /// </summary> /// <param name="enumedWnd"></param> /// <param name="enumedWndSet"></param> /// <returns></returns> public static bool ChildWindowEnumCallBack(IntPtr enumedWnd, ref User32Api.EnumCallBackModel enumedWndSet) { //将枚举到的窗口添加到集合中传出 enumedWndSet.Hwnds.Add(enumedWnd); return(true); }