ClassWindowManager
Provides basic Win32 window management services like searching ...etc.
Definition
Namespace:ArtOfTest.Common.Win32
Assembly:ArtOfTest.WebAii.dll
Syntax:
public class WindowManager
Inheritance: objectWindowManager
Constructors
Properties
Items
Returns the collection of windows populated by a call to GetWindows()
Declaration
public WindowCollection Items { get; }
Property Value
VisibleWindowsOnly
Gets or sets whether to filter window to visible windows only. Default is false.
Methods
AppendWindows(IntPtr)
Append all child windows of the passed in parentHwnd to the current collection. (Items)
Declaration
public void AppendWindows(IntPtr parentHwnd)
Parameters
parentHwnd
The window to append children of.
CenterSize(Size, Rectangle)
Calculate the correct point (x,y) for a specific size to be centered within a specific rectangle.
FindWindowRecursively(IntPtr, string, bool, int)
Find a window recursively using its caption.
Declaration
public static Window FindWindowRecursively(IntPtr parentHwnd, string caption, bool partialCaption, int delaySearchPeriod)
Parameters
parentHwnd
The parent window to search under. If Zero, will search all deskop windows.
caption
The caption to find.
partialCaption
Use partial caption matching or exact. (In both cases the matching is case-insensitive).
delaySearchPeriod
The number of milli-seconds to delay the start of the search to allow the window we are searching for to be constructed. (if 0, no delay will occur)
Returns
The found window or null;
FindWindowRecursively(IntPtr, string, bool, int, int)
Find a window recursively using its caption.
Declaration
public static Window FindWindowRecursively(IntPtr parentHwnd, string caption, bool partialCaption, int delaySearchPeriod, int maxDepth)
Parameters
parentHwnd
The parent window to search under. If Zero, will search all deskop windows.
caption
The caption to find.
partialCaption
Use partial caption matching or exact. (In both cases the matching is case-insensitive).
delaySearchPeriod
The number of milli-seconds to delay the start of the search to allow the window we are searching for to be constructed. (if 0, no delay will occur)
maxDepth
The maximum depth level at which we will try to get the proper window.
Returns
The found window or null;
FindWindowRecursively(IntPtr, string, int)
Find a window recusively under the parent window. Will return the first window that matches the class name.
Declaration
public static Window FindWindowRecursively(IntPtr parentHwnd, string className, int delaySearchPeriod)
Parameters
parentHwnd
The parent window to search under. If Zero, will search all desktop windows.
className
The class name to search for. (case-insensitive)
delaySearchPeriod
The number of milli-seconds to delay the start of the search to allow the window we are searching for to be constructed. (if 0, no delay will occur)
Returns
The window that matches, otherwise null.
FindWindowsRecursively(IntPtr, List<string>, int, int)
Finds all windows of a given class under the parent window.
Declaration
public static IList<Window> FindWindowsRecursively(IntPtr parentHwnd, List<string> classNames, int delaySearchPeriod, int maxDepth = 2147483647)
Parameters
parentHwnd
The parent window to search under. If Zero, will search all desktop windows.
classNames
A list of class names to search for (case-insensitive)
delaySearchPeriod
Search max depth. The number of milliseconds to delay the start of the search to allow the window we are searching for to be constructed.maxDepth
Returns
A list of all windows of the specified class under the parent window
GetActiveScreen()
Returns the active screen the user is using.
Declaration
public static Screen GetActiveScreen()
Returns
The active screen the user is using
GetAllWindows(Process)
Populate the Items collection with all windows associated with this process including child windows of each.
Declaration
public void GetAllWindows(Process process)
Parameters
process
The process
GetProcessDialogFrameWindows(int)
Declaration
public static IEnumerable<Window> GetProcessDialogFrameWindows(int processId)
Parameters
processId
Returns
GetWindows()
Populate the Items collection with all top level windows.
Declaration
public void GetWindows()
GetWindows(IntPtr)
Populate the Items collection with all child windows of the parent window passed in (Recursive)
Declaration
public void GetWindows(IntPtr parentHwnd)
Parameters
parentHwnd
The parent window.
GetWindows(Process)
Populate the Items collection with all non-child windows associated with this process.
Declaration
public void GetWindows(Process process)
Parameters
process
The process
RecommendSize(Rectangle, Size)
Recommend the actual size of the window to use.
TileWindows(Window, Window, TileWindowsOption, Size)
Tiles two windows
Declaration
public static void TileWindows(Window window1, Window window2, TileWindowsOption option, Size window1MinSize)
Parameters
window1
The first window
window2
The second window
option
Tiling option
window1MinSize
The first window minimum size.