private IntPtr FindMessageBox() { IntPtr foundWindowHandle = IntPtr.Zero; if (handle != new IntPtr(0)) { return(handle); } IntPtr desktop = Win32.GetDesktopWindow(); Win32.EnumChildWindows( desktop, delegate(IntPtr hwnd, IntPtr lParam) { if (WindowHandle.IsDialog(hwnd)) { if (name == null || WindowHandle.GetCaption(hwnd) == name) { foundWindowHandle = hwnd; } } return(1); }, IntPtr.Zero); if (foundWindowHandle == IntPtr.Zero) { throw new ControlNotVisibleException("Message Box not visible"); } return(foundWindowHandle); }
/// <summary> /// Finds the OpenFileDialog. /// </summary> protected static IntPtr FindFileDialog() { IntPtr desktop = Win32.GetDesktopWindow(); IntPtr res = IntPtr.Zero; Win32.EnumChildWindows(desktop, delegate(IntPtr hwnd, IntPtr lParam) { if (WindowHandle.IsDialog(hwnd)) { string name = WindowHandle.GetCaption(hwnd); if (name == FileDialogTester.InitialFileDialogName // Vista 64 hack || name == "Save as" || name == "Enregistrer sous" || name == "Speichern unter") { res = hwnd; } } return(1); }, IntPtr.Zero); if (res == IntPtr.Zero) { throw new ControlNotVisibleException("Open File Dialog is not visible"); } return(res); }
/// <summary> /// Finds all of the forms with a specified name and returns them in a FormCollection. /// </summary> /// <param name="name">The name of the form to search for.</param> /// <returns>the FormCollection of all found forms.</returns> public FormCollection FindAll(string name) { lock (this) { forms = new FormCollection(); this.name = name; IntPtr desktop = Win32.GetDesktopWindow(); Win32.EnumChildWindows(desktop, new Win32.WindowEnumProc(OnEnumWindow), IntPtr.Zero); return(forms); } }
/// <summary> /// Finds all of the forms with a specified name and returns them in a FormCollection. /// </summary> /// <param name="formName">The name of the form to search for.</param> /// <returns>the FormCollection of all found forms.</returns> public List <Form> FindAll(string formName) { lock (this) { forms = new List <Form>(); name = formName; IntPtr desktop = Win32.GetDesktopWindow(); Win32.EnumChildWindows(desktop, FindMatchingForms, IntPtr.Zero); return(forms); } }
/// <summary> /// Finds all of the forms with a specified name and returns them in a FormCollection. /// </summary> /// <param name="name">The name of the form to search for.</param> /// <returns>the FormCollection of all found forms.</returns> public FormCollection FindAll(string name) { lock (this) { forms = new FormCollection(); this.name = name; if (Environment.OSVersion.Platform != PlatformID.Unix) { IntPtr desktop = Win32.GetDesktopWindow(); Win32.EnumChildWindows(desktop, new Win32.WindowEnumProc(OnEnumWindow), IntPtr.Zero); } return(forms); } }
/// <summary> /// Finds the OpenFileDialog. /// </summary> /// <returns></returns> protected IntPtr FindFileDialog() { if (_handle != new IntPtr(0)) { return(_handle); } lock (this) { IntPtr desktop = Win32.GetDesktopWindow(); Win32.EnumChildWindows(desktop, new Win32.WindowEnumProc(OnEnumWindow), IntPtr.Zero); if (_wParam == IntPtr.Zero) { throw new ControlNotVisibleException("Open File Dialog is not visible"); } return(_wParam); } }
private IntPtr FindMessageBox() { if (handle != new IntPtr(0)) { return(handle); } lock (this) { IntPtr desktop = Win32.GetDesktopWindow(); Win32.EnumChildWindows(desktop, new Win32.WindowEnumProc(OnEnumWindow), IntPtr.Zero); if (wParam == IntPtr.Zero) { throw new ControlNotVisibleException("Message Box not visible"); } return(wParam); } }