Class InteropWindowExtensions
Extensions for the interopWindow, all get or set commands update the value in the InteropWindow that is used.
Inheritance
Namespace: Dapplo.Windows.Desktop
Assembly: Dapplo.Windows.dll
Syntax
public static class InteropWindowExtensions : object
Methods
| Improve this Doc View SourceExists(IInteropWindow)
Tests if the interopWindow still exists
Declaration
public static bool Exists(this IInteropWindow interopWindow)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | IInteropWindow |
Returns
Type | Description |
---|---|
System.Boolean | True if it's still there. Because window handles are recycled the handle could point to a different window! |
Fill(IInteropWindow, InteropWindowCacheFlags)
Fill ALL the information of the InteropWindow
Declaration
public static IInteropWindow Fill(this IInteropWindow interopWindow, InteropWindowCacheFlags cacheFlags = null)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
InteropWindowCacheFlags | cacheFlags | InteropWindowCacheFlags to specify which information is retrieved and what not |
Returns
Type | Description |
---|---|
IInteropWindow |
GetCaption(IInteropWindow, Boolean)
Get the Windows caption (title)
Declaration
public static string GetCaption(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
System.String | string with the caption |
GetChildren(IInteropWindow, Boolean)
Get the children of the specified interopWindow, this is not lazy!
Declaration
public static IEnumerable<IInteropWindow> GetChildren(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | True to force updating |
Returns
Type | Description |
---|---|
IEnumerable<IInteropWindow> | IEnumerable with InteropWindow |
GetClassname(IInteropWindow, Boolean)
Get the Windows class name
Declaration
public static string GetClassname(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
System.String | string with the classname |
GetInfo(IInteropWindow, Boolean)
Get the WindowInfo
Declaration
public static WindowInfo GetInfo(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
WindowInfo | WindowInfo |
GetParent(IInteropWindow, Boolean)
Get the parent
Declaration
public static IntPtr GetParent(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
IntPtr | IntPtr for the parent |
GetParentWindow(IInteropWindow, Boolean)
Get the parent IInteropWindow
Declaration
public static IInteropWindow GetParentWindow(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
IInteropWindow | IInteropWindow for the parent |
GetPlacement(IInteropWindow, Boolean)
Get the WindowPlacement
Declaration
public static WindowPlacement GetPlacement(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
WindowPlacement | WindowPlacement |
GetProcessId(IInteropWindow, Boolean)
Get the process which the specified window belongs to, the value is cached into the ProcessId of the WindowInfo
Declaration
public static int GetProcessId(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
System.Int32 | int with process Id |
GetRegion(IInteropWindow)
Get the region for a window
Declaration
public static Region GetRegion(this IInteropWindow interopWindow)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
Returns
Type | Description |
---|---|
Region |
GetText(IInteropWindow, Boolean)
Get text from the window
Declaration
public static string GetText(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
System.String | string with the text |
GetWindowScroller(IInteropWindow, ScrollBarTypes, Boolean)
Extension method to create a WindowScroller
Declaration
public static WindowScroller GetWindowScroller(this IInteropWindow interopWindow, ScrollBarTypes scrollBarType = null, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | IInteropWindow |
ScrollBarTypes | scrollBarType | ScrollBarTypes |
System.Boolean | forceUpdate | true to force a retry, even if the previous check failed |
Returns
Type | Description |
---|---|
WindowScroller | WindowScroller or null |
GetZOrderedChildren(IInteropWindow, Boolean)
Get the children of the specified interopWindow, from top to bottom. This is not lazy This might get different results than the GetChildren
Declaration
public static IEnumerable<IInteropWindow> GetZOrderedChildren(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | True to force updating |
Returns
Type | Description |
---|---|
IEnumerable<IInteropWindow> | IEnumerable with InteropWindow |
IsDockedToLeftOf(IInteropWindow, IInteropWindow, Func<IInteropWindow, RECT>)
Returns if the IInteropWindow is docked to the left of the other IInteropWindow
Declaration
public static bool IsDockedToLeftOf(this IInteropWindow window1, IInteropWindow window2, Func<IInteropWindow, RECT> retrieveBoundsFunc = null)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | window1 | IInteropWindow |
IInteropWindow | window2 | IInteropWindow |
Func<IInteropWindow, RECT> | retrieveBoundsFunc | Function which returns the bounds for the IInteropWindow |
Returns
Type | Description |
---|---|
System.Boolean | bool true if docked |
IsDockedToRightOf(IInteropWindow, IInteropWindow, Func<IInteropWindow, RECT>)
Returns if the IInteropWindow is docked to the left of the other IInteropWindow
Declaration
public static bool IsDockedToRightOf(this IInteropWindow window1, IInteropWindow window2, Func<IInteropWindow, RECT> retrieveBoundsFunc = null)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | window1 | IInteropWindow |
IInteropWindow | window2 | IInteropWindow |
Func<IInteropWindow, RECT> | retrieveBoundsFunc | Function which returns the bounds for the IInteropWindow |
Returns
Type | Description |
---|---|
System.Boolean | bool true if docked |
IsMaximized(IInteropWindow, Boolean)
Retrieve if the window is maximized (Iconic)
Declaration
public static bool IsMaximized(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
System.Boolean | bool true if Iconic (minimized) |
IsMinimized(IInteropWindow, Boolean)
Retrieve if the window is minimized (Iconic)
Declaration
public static bool IsMinimized(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
System.Boolean | bool true if Iconic (minimized) |
IsVisible(IInteropWindow, Boolean)
Retrieve if the window is Visible (IsWindowVisible, whatever that means)
Declaration
public static bool IsVisible(this IInteropWindow interopWindow, bool forceUpdate = false)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
System.Boolean | forceUpdate | set to true to make sure the value is updated |
Returns
Type | Description |
---|---|
System.Boolean | bool true if minimizedIconic (minimized) |
Maximized(IInteropWindow)
Maximize the window
Declaration
public static void Maximized(this IInteropWindow interopWindow)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
Minimize(IInteropWindow)
Minimize the Window
Declaration
public static void Minimize(this IInteropWindow interopWindow)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
Restore(IInteropWindow)
Restore (Un-Minimize/Maximize) the Window
Declaration
public static void Restore(this IInteropWindow interopWindow)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
SetExtendedStyle(IInteropWindow, ExtendedWindowStyleFlags)
Set the Extended WindowStyle
Declaration
public static void SetExtendedStyle(this IInteropWindow interopWindow, ExtendedWindowStyleFlags extendedWindowStyleFlags)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
ExtendedWindowStyleFlags | extendedWindowStyleFlags | ExtendedWindowStyleFlags |
SetPlacement(IInteropWindow, WindowPlacement)
Set the WindowPlacement
Declaration
public static void SetPlacement(this IInteropWindow interopWindow, WindowPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
WindowPlacement | placement | WindowPlacement |
SetStyle(IInteropWindow, WindowStyleFlags)
Set the WindowStyle
Declaration
public static void SetStyle(this IInteropWindow interopWindow, WindowStyleFlags windowStyleFlags)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | InteropWindow |
WindowStyleFlags | windowStyleFlags | WindowStyleFlags |
ToForegroundAsync(IInteropWindow, Boolean)
Set the window as foreground window
Declaration
public static Task ToForegroundAsync(this IInteropWindow interopWindow, bool workaround = true)
Parameters
Type | Name | Description |
---|---|---|
IInteropWindow | interopWindow | The window to bring to the foreground |
System.Boolean | workaround | bool with true to use a trick to really bring the window to the foreground |
Returns
Type | Description |
---|---|
Task |