public void Flash() { if (this.CheckHandle()) { WindowInformation.FlashWindow(this.Handle, true); } }
private static bool MyEnumDesktopWindows(IntPtr hwnd, IntPtr lParam) { IntPtr windowThreadProcessId = WindowInformation.GetWindowThreadProcessId(hwnd, 0); IntPtr threadDesktop = WindowInformation.GetThreadDesktop(windowThreadProcessId); WindowInformation.CloseDesktop(threadDesktop); bool result; if (threadDesktop == lParam) { WindowInformation windowInformation = new WindowInformation(hwnd); if (!windowInformation.Visible) { result = true; return(result); } string text = windowInformation.Text; if (text == null || text.Length == 0) { result = true; return(result); } WindowInformation.myDesktopWindows.Add(windowInformation); } result = true; return(result); }
public bool SetParent(IntPtr newParentHandle) { bool result; if (newParentHandle == IntPtr.Zero || !WindowInformation.IsWindow(newParentHandle)) { result = false; } else if (this.CheckHandle()) { IntPtr value = WindowInformation.SetParent(this.Handle, newParentHandle); if (value == IntPtr.Zero) { this.InnerThrowWin32Exception(); result = false; } else { result = true; } } else { result = false; } return(result); }
public void Activate() { if (this.CheckHandle()) { WindowInformation.SetForegroundWindow(this.Handle); } }
public void Close() { if (this.CheckHandle()) { WindowInformation.SendMessage(this.Handle, 16, 0, 0); } }
public bool IsParent(IntPtr parentHandle) { bool result; if (parentHandle == IntPtr.Zero || !WindowInformation.IsWindow(parentHandle)) { result = false; } else { if (this.CheckHandle()) { IntPtr intPtr = this.Handle; while (intPtr != IntPtr.Zero) { intPtr = WindowInformation.GetParent(intPtr); if (intPtr == parentHandle) { result = true; return(result); } if (intPtr == IntPtr.Zero) { break; } } } result = false; } return(result); }
public void BringToTop() { if (this.CheckHandle()) { if (!WindowInformation.BringWindowToTop(this.Handle)) { this.InnerThrowWin32Exception(); } } }
public bool UpdateLayout() { WindowInformation windowInformation = new WindowInformation(this.ControlHandle); WindowInformation windowInformation2 = new WindowInformation(this.ContainerHandle); bool result; if (!windowInformation.CheckHandle() || !windowInformation2.CheckHandle()) { result = false; } else { if (windowInformation.ParentHandle != windowInformation2.Handle) { if (!windowInformation.SetParent(windowInformation2.Handle)) { result = false; return(result); } } Rectangle clientBounds = windowInformation2.ClientBounds; Rectangle bounds = windowInformation.Bounds; Rectangle rectangle = bounds; switch (this.Dock) { case DockStyle.Top: rectangle = new Rectangle(0, 0, clientBounds.Width, bounds.Height); break; case DockStyle.Bottom: rectangle = new Rectangle(0, clientBounds.Height - bounds.Height, clientBounds.Width, bounds.Height); break; case DockStyle.Left: rectangle = new Rectangle(0, 0, bounds.Width, clientBounds.Height); break; case DockStyle.Right: rectangle = new Rectangle(clientBounds.Width - bounds.Width, 0, bounds.Width, clientBounds.Height); break; case DockStyle.Fill: rectangle = clientBounds; break; } if (rectangle != bounds) { windowInformation.Bounds = rectangle; } result = true; } return(result); }
public static WindowInformation FromHandle(IntPtr handle) { WindowInformation result; if (WindowInformation.CheckHandle(handle)) { WindowInformation windowInformation = new WindowInformation(handle); result = windowInformation; } else { result = null; } return(result); }
public static WindowInformation GetFocusWindow() { IntPtr focus = WindowInformation.GetFocus(); WindowInformation result; if (focus != IntPtr.Zero) { result = new WindowInformation(focus); } else { result = null; } return(result); }
public Process GetOwnerProcess() { Process result; if (this.CheckHandle()) { int num = 0; int windowThreadProcessId = WindowInformation.GetWindowThreadProcessId(this.Handle, ref num); if (num != 0) { result = Process.GetProcessById(num); return(result); } } result = null; return(result); }
public WindowInformation GetTopLevelParentWindow() { WindowInformation[] desktopWindows = WindowInformation.DesktopWindows; WindowInformation result; for (WindowInformation windowInformation = this; windowInformation != null; windowInformation = windowInformation.Parent) { WindowInformation[] array = desktopWindows; for (int i = 0; i < array.Length; i++) { WindowInformation windowInformation2 = array[i]; if (windowInformation2.Handle == windowInformation.Handle) { result = windowInformation2; return(result); } } } result = null; return(result); }
public static bool CheckHandle(IntPtr handle) { return(!(handle == IntPtr.Zero) && WindowInformation.IsWindow(handle)); }
public bool CheckHandle() { return(!(this.myControl.Handle == IntPtr.Zero) && WindowInformation.IsWindow(this.myControl.Handle)); }