public ApiWindow[] GetChildWindows(IntPtr hwnd) { _listChildren.Clear(); EnumCallBackDelegate enumChildWindowProc = delegate(IntPtr inthwnd, int lParam) { var window = GetWindowIdentification(inthwnd); if (_childClass.Length == 0 || _childClass.ToLower().Equals(window.ClassName.ToLower())) { _listChildren.Add(window); } return(1); }; EnumChildWindows(hwnd, enumChildWindowProc, 0); return(_listChildren.ToArray()); }
public ApiWindow[] GetTopLevelWindows() { EnumCallBackDelegate enumWindowProc = delegate(IntPtr inthwnd, int lParam) { if (GetParent(inthwnd) != 0 || IsWindowVisible(inthwnd) != 0) { return(1); } var window = GetWindowIdentification(inthwnd); if (_topLevelClass.Length == 0 || _topLevelClass.ToLower().Equals(window.ClassName.ToLower())) { _listTopLevel.Add(window); } return(1); }; EnumWindows(enumWindowProc, 0); return(_listTopLevel.ToArray()); }
private static extern int EnumChildWindows(int hWndParent, EnumCallBackDelegate lpEnumFunc, int lParam);
private static extern int EnumWindows(EnumCallBackDelegate lpEnumFunc, int lParam);
public static extern bool EnumWindows(EnumCallBackDelegate lpEnumFunc, IntPtr lParam);