public FakeWindow(IntPtr handle, FakeWindow parent, string className = null, string name = null) { if (handle == IntPtr.Zero) { throw new ArgumentOutOfRangeException(nameof(handle) + " cannot be zero"); } Handle = handle; Parent = parent; ClassName = !string.IsNullOrEmpty(className) ? className : GetWindowClassName(handle); Name = !string.IsNullOrEmpty(name) ? name : GetWindowName(handle); }
public static List <FakeWindow> GetWindows(string className, string windowTitle) { var hwnd = IntPtr.Zero; var windows = new List <FakeWindow>(); while ((hwnd = Win32API.FindWindowEx(IntPtr.Zero, hwnd, className, windowTitle)) != IntPtr.Zero) { FakeWindow window = new FakeWindow(hwnd, IntPtr.Zero, className, windowTitle); windows.Add(window); } return(windows); }
public FakeWindow(IntPtr handle, IntPtr parentHandle, string className = null, string name = null) { if (handle == IntPtr.Zero) { throw new ArgumentOutOfRangeException(nameof(handle) + " cannot be zero"); } if (parentHandle != IntPtr.Zero) { Parent = new FakeWindow(parentHandle, Win32API.GetParent(parentHandle)); } else { Parent = null; } Handle = handle; ClassName = !string.IsNullOrEmpty(className) ? className : GetWindowClassName(handle); Name = !string.IsNullOrEmpty(name) ? name : GetWindowName(handle); }
public FakeClientWindow(IntPtr handle, FakeWindow parent, string className, string windowName, FakeWindow innerWindow) : base(handle, parent, className, windowName) { InnerWindow = innerWindow; }