Esempio n. 1
0
 Util.ArrayBuilder_ <AWnd> _AllChildren(AWnd wParent)
 {
     wParent.ThrowIfInvalid();
     return(Internal_.EnumWindows2(Internal_.EnumAPI.EnumChildWindows,
                                   onlyVisible: 0 == (_flags & WCFlags.HiddenToo),
                                   sortFirstVisible: true,
                                   wParent: wParent,
                                   directChild: 0 != (_flags & WCFlags.DirectChild)));
 }
Esempio n. 2
0
 /// <summary>
 /// Finds accessible object (AO) in the specified control of window w.
 /// Returns true if found. The <see cref="Result"/> property will be the found AO.
 /// </summary>
 /// <param name="w">Window that contains the control.</param>
 /// <param name="controls">Control properties. This functions searches in all matching controls.</param>
 /// <exception cref="Exception">Exceptions of <see cref="Find(AWnd)"/>.</exception>
 /// <remarks>
 /// Alternatively you can specify control class name or id in role. How this function is different: 1. Allows to specify more control properties. 2. Works better/faster when the control is of a different process or thread than the parent window; else slightly slower.
 /// </remarks>
 public bool Find(AWnd w, AWnd.ChildFinder controls)
 {
     w.ThrowIfInvalid();
     foreach (var c in controls.FindAll(w))
     {
         try {
             if (_FindOrWait(c, 0, false))
             {
                 controls.Result = c;
                 return(true);
             }
         }
         catch (AuException ex) when(!c.IsAlive)
         {
             ADebug.Print(ex.Message);
         }                                                                                        //don't throw AuWndException/AuException if the window or a control is destroyed while searching, but throw AuException if eg access denied
     }
     return(false);
 }
Esempio n. 3
0
 /// <summary>
 /// Creates image from a rectangle of window client area pixels.
 /// </summary>
 /// <param name="w">Window or control.</param>
 /// <param name="rect">A rectangle in w client area coordinates. Use <c>w.ClientRect</c> to get whole client area.</param>
 /// <param name="usePrintWindow">Use flag <see cref="WICFlags.PrintWindow"/>.</param>
 /// <exception cref="AuWndException">Invalid w.</exception>
 /// <exception cref="ArgumentException">Empty rectangle.</exception>
 /// <exception cref="AuException">Failed. Probably there is not enough memory for bitmap of this size (with*height*4 bytes).</exception>
 /// <remarks>
 /// How this is different from <see cref="Capture(RECT)"/>:
 /// 1. Gets pixels from window's device context (DC), not from screen DC, unless the Aero theme is turned off (on Windows 7). The window can be under other windows. The image can be different.
 /// 2. If the window is partially or completely transparent, gets non-transparent image.
 /// 3. Does not work with Windows Store app windows, Chrome and some other windows. Creates black image.
 /// 4. If the window is DPI-scaled, captures its non-scaled view. And <i>rect</i> must contain non-scaled coordinates.
 /// </remarks>
 public static Bitmap Capture(AWnd w, RECT rect, bool usePrintWindow = false)
 {
     w.ThrowIfInvalid();
     return(_Capture(rect, w, usePrintWindow));
 }
Esempio n. 4
0
 /// <summary>
 /// Creates image from a non-rectangular area of window client area pixels.
 /// </summary>
 /// <param name="w">Window or control.</param>
 /// <param name="outline">The outline (shape) of the area in w client area coordinates. If single element, captures single pixel.</param>
 /// <param name="usePrintWindow">Use flag <see cref="WICFlags.PrintWindow"/>.</param>
 /// <exception cref="AuWndException">Invalid <i>w</i>.</exception>
 /// <exception cref="ArgumentException"><i>outline</i> is null or has 0 elements.</exception>
 /// <exception cref="AuException">Failed. Probably there is not enough memory for bitmap of this size.</exception>
 /// <remarks>More info: <see cref="Capture(AWnd, RECT, bool)"/>.</remarks>
 public static Bitmap Capture(AWnd w, List <POINT> outline, bool usePrintWindow = false)
 {
     w.ThrowIfInvalid();
     return(_Capture(outline, w, usePrintWindow));
 }
Esempio n. 5
0
 bool _FindOrWait(AWnd w, double secondsTimeout, bool isWaitFunc)
 {
     w.ThrowIfInvalid();
     return(_Find(w, default, secondsTimeout, isWaitFunc));