ClassWindow
For internal use only.
Definition
Namespace:ArtOfTest.Common.Win32
Assembly:ArtOfTest.WebAii.dll
Syntax:
public class Window
Inheritance: objectWindow
Derived Classes:
Constructors
Window(IntPtr)
Constructs a new instance of this class for the specified Window Handle.
Fields
Properties
AllChildren
Gets a collection of all child windows (at any level) of this window.
Declaration
public virtual WindowCollection AllChildren { get; }
Property Value
Caption
Gets the window's caption.
ClassName
Gets the window's class name.
Enabled
Gets whether this window is enabled or not.
Exists
Gets whether the window handle represents a live native window.
Handle
Gets the handle of the window.
IsDialog
Gets whether this Window is a dialog
IsForegroundWindow
Gets whether the window is currently in use by the user.
IsMaximized
Gets whether the window is maximized.
IsMinimized
Gets whether the window is minimized.
IsVisible
Gets whether the window is visible.
Location
Gets the top left point of the location of the window relative to the screen.
OwnerProcess
The owner process that created this window.
ParentWindow
Get parent window of this window. Returns null if there is no parent window.
Rectangle
Gets the rectangle of the window.
Methods
AttachWrappedWindow()
Attach to the wrapper window handle. This call is needed to allow for events to fire on this window.
Declaration
public virtual void AttachWrappedWindow()
Remarks
The window attached to must be in the same process as this window object for it to intercept its messages and fire its events
Center()
Get the center point of this window
ContainsControl(int)
Returns true/false whether the Win32 control id is a child of this window
ContainsText(string, bool)
Returns true/false whether the text is present within this window.
Declaration
public virtual bool ContainsText(string text, bool refreshChildren)
Parameters
text
The text to check.
refreshChildren
True/False whether to refresh the Children of this window or simply use the cached collection.
Returns
True/False whether the text exists.
DetachWrappedWindow()
Detach from the window handle.
Declaration
public void DetachWrappedWindow()
EnumHwndAncestors(HWND)
Declaration
public static IEnumerable<HWND> EnumHwndAncestors(HWND hwnd)
Parameters
hwnd
Returns
GetBitmap(RectangleF)
Returns a bitmap of a specified target area within this window.
Declaration
public Bitmap GetBitmap(RectangleF targetArea)
Parameters
targetArea
The target area to return the bitmap for.
Returns
The bitmap of that target area as it appears in the window.
GetBitmap(Size)
Capture the entire window bitmap and returns it.
GetHashCode()
The hash code is the window's hwnd.
Declaration
public override int GetHashCode()
Returns
The Window Handle of this window
Overrides
GetText()
Get the text contained in this window and all its children windows.
Declaration
public virtual string GetText()
Returns
Returns a text concatenation of this window and all its children
GetWindowText()
Get current text of the window.
Declaration
public virtual string GetWindowText()
Returns
Current text of the window.
IsHwndDialog(HWND)
Gets whether the provided window handle represents a dialog
MakeAbsolute(Rectangle)
Return the absolute coordinate of the relative rectangle.
MakeRelative(Rectangle)
Make the absolute rects passed in relative to this window.
Move(Rectangle, bool)
Move this window to a new location
OnDoubleClick()
For internal use only.
Declaration
protected virtual void OnDoubleClick()
OnKeyDown(KeyEventArgs)
For internal use only.
Declaration
protected virtual void OnKeyDown(KeyEventArgs e)
Parameters
e
A KeyEventArgs that contains the event data.
OnKeyPressed(KeyPressEventArgs)
For internal use only.
Declaration
protected virtual void OnKeyPressed(KeyPressEventArgs e)
Parameters
e
A KeyPressEventArgs that contains the event data.
OnKeyUp(KeyEventArgs)
For internal use only.
Declaration
protected virtual void OnKeyUp(KeyEventArgs e)
Parameters
e
OnMouseClick(MouseButtons, int, int, int)
For internal use only.
Declaration
protected virtual void OnMouseClick(MouseButtons button, int clicks, int x, int y)
Parameters
button
A MouseButtons that specifiesd which mouse button is associated with this event.
clicks
An int specifying the number of times the mouse button was pressed and released.
x
The x-coordinate in pixels of the mouse during the generating mouse event.
y
The y-coordinate in pixels of the mouse during the generating mouse event.
OnMouseClick(MouseEventArgs)
For internal use only.
Declaration
protected virtual void OnMouseClick(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data.
OnMouseDoubleClick(MouseButtons, int, int, int)
For internal use only.
Declaration
protected virtual void OnMouseDoubleClick(MouseButtons button, int clicks, int x, int y)
Parameters
button
A MouseButtons that specifiesd which mouse button is associated with this event.
clicks
An int specifying the number of times the mouse button was pressed and released.
x
The x-coordinate in pixels of the mouse during the generating mouse event.
y
The y-coordinate in pixels of the mouse during the generating mouse event.
OnMouseDown(MouseButtons, int, int)
For internal use only.
Declaration
protected virtual void OnMouseDown(MouseButtons button, int x, int y)
Parameters
button
A MouseButtons that specifiesd which mouse button is associated with this event.
x
The x-coordinate in pixels of the mouse during the generating mouse event.
y
The y-coordinate in pixels of the mouse during the generating mouse event.
OnMouseDown(MouseEventArgs)
For internal use only.
Declaration
protected virtual void OnMouseDown(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data.
OnMouseMove(int, int)
For internal use only.
OnMouseUp(MouseButtons, int, int)
For internal use only.
Declaration
protected virtual void OnMouseUp(MouseButtons button, int x, int y)
Parameters
button
A MouseButtons that specifiesd which mouse button is associated with this event.
x
The x-coordinate in pixels of the mouse during the generating mouse event.
y
The y-coordinate in pixels of the mouse during the generating mouse event.
OnMouseUp(MouseEventArgs)
For internal use only.
Declaration
protected virtual void OnMouseUp(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data.
OnPreMouseClick(MouseEventArgs)
For internal use only.
Declaration
protected virtual void OnPreMouseClick(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data.
OnPreMouseDown(MouseEventArgs)
For internal use only.
Declaration
protected virtual void OnPreMouseDown(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data.
OnPreMouseUp(MouseEventArgs)
For internal use only.
Declaration
protected void OnPreMouseUp(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data.
OnWindowMoved()
For internal use only.
Declaration
protected virtual void OnWindowMoved()
RefreshChildren()
Refresh the list of child windows (Window.Children) of this window
Declaration
public virtual void RefreshChildren()
Restore()
Restore the window to its default size/location
Declaration
public virtual void Restore()
SetFocus()
Restores and Brings the window to the front, assuming it is a visible application window.
Declaration
public virtual void SetFocus()
SetPosition(WindowPosition)
Declaration
public virtual void SetPosition(WindowPosition position)
Parameters
position
Update()
Update the window. Invalidates all areas and forces a redraw.
Declaration
public virtual void Update()
WaitForVisibility(bool, int)
Waits for a certain visibility state for a window
Declaration
public void WaitForVisibility(bool visibilityState, int timeout)
Parameters
visibilityState
The visibility state of the window to wait for. True: wait until window is visible (The window needs to have its handle created before calling this method), False, wait until window is invisible.
timeout
The wait timeout in msecs.
WaitForVisibility(bool, int, bool)
Waits for a certain visibility state for a window
Declaration
public bool WaitForVisibility(bool visibilityState, int timeout, bool suppressException)
Parameters
visibilityState
The visibility state of the window to wait for. True: wait until window is visible (The window needs to have its handle created before calling this method), False, wait until window is invisible.
timeout
The wait timeout in msecs.
suppressException
Whether to throw or return false if the window does not reach the desired visibility state.
Returns
Events
Click
For internal use only.
DoubleClick
For internal use only.
KeyDown
For internal use only.
KeyPressed
For internal use only.
Declaration
public event KeyPressEventHandler KeyPressed
Event Value
KeyUp
For internal use only.
MouseClick
For internal use only.
Declaration
public event MouseEventHandler MouseClick
Event Value
MouseDoubleClick
For internal use only.
Declaration
public event MouseEventHandler MouseDoubleClick
Event Value
MouseDown
For internal use only.
Declaration
public event MouseEventHandler MouseDown
Event Value
MouseMove
For internal use only.
Declaration
public event MouseEventHandler MouseMove
Event Value
MouseUp
For internal use only.
PreMouseClick
For internal use only.
Declaration
public event MouseEventHandler PreMouseClick
Event Value
PreMouseDown
For internal use only.
Declaration
public event MouseEventHandler PreMouseDown
Event Value
PreMouseUp
For internal use only.
Declaration
public event MouseEventHandler PreMouseUp
Event Value
WindowMoved
For internal use only.