C# Class Binarysharp.MemoryManagement.Windows.WindowCore

Static core class providing tools for managing windows.
Show file Open project: ZenLulz/MemorySharp Class Usage Examples

Public Methods

Method Description
EnumAllWindows ( ) : IEnumerable

Enumerates all the windows on the screen.

EnumChildWindows ( IntPtr parentHandle ) : IEnumerable

Enumerates recursively all the child windows that belong to the specified parent window.

EnumTopLevelWindows ( ) : IEnumerable

Enumerates all top-level windows on the screen. This function does not search child windows.

FlashWindow ( IntPtr windowHandle ) : bool

Flashes the specified window one time. It does not change the active state of the window. To flash the window a specified number of times, use the FlashWindowEx(IntPtr, FlashWindowFlags, uint, TimeSpan) function.

FlashWindowEx ( IntPtr windowHandle, FlashWindowFlags flags ) : void

Flashes the specified window. It does not change the active state of the window. The function uses the default cursor blink rate.

FlashWindowEx ( IntPtr windowHandle, FlashWindowFlags flags, uint count ) : void

Flashes the specified window. It does not change the active state of the window. The function uses the default cursor blink rate.

FlashWindowEx ( IntPtr windowHandle, FlashWindowFlags flags, uint count, System.TimeSpan timeout ) : void

Flashes the specified window. It does not change the active state of the window.

GetClassName ( IntPtr windowHandle ) : string

Retrieves the name of the class to which the specified window belongs.

GetForegroundWindow ( ) : IntPtr

Retrieves a handle to the foreground window (the window with which the user is currently working).

GetSystemMetrics ( SystemMetrics metric ) : int

Retrieves the specified system metric or system configuration setting.

GetWindowPlacement ( IntPtr windowHandle ) : WindowPlacement

Retrieves the show state and the restored, minimized, and maximized positions of the specified window.

GetWindowProcessId ( IntPtr windowHandle ) : int

Retrieves the identifier of the process that created the window.

GetWindowText ( IntPtr windowHandle ) : string

Gets the text of the specified window's title bar.

GetWindowThreadId ( IntPtr windowHandle ) : int

Retrieves the identifier of the thread that created the specified window.

MapVirtualKey ( Keys key, TranslationTypes translation ) : uint

Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx function.

MapVirtualKey ( uint key, TranslationTypes translation ) : uint

Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx function.

PostMessage ( IntPtr windowHandle, WindowsMessages message, UIntPtr wParam, UIntPtr lParam ) : void

Places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.

PostMessage ( IntPtr windowHandle, uint message, UIntPtr wParam, UIntPtr lParam ) : void

Places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.

SendInput ( Input inputs ) : void

Synthesizes keystrokes, mouse motions, and button clicks.

SendMessage ( IntPtr windowHandle, WindowsMessages message, UIntPtr wParam, IntPtr lParam ) : IntPtr

Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.

SendMessage ( IntPtr windowHandle, uint message, UIntPtr wParam, IntPtr lParam ) : IntPtr

Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.

SetForegroundWindow ( IntPtr windowHandle ) : void

Brings the thread that created the specified window into the foreground and activates the window. The window is restored if minimized. Performs no action if the window is already activated.

SetWindowPlacement ( IntPtr windowHandle, WindowPlacement placement ) : void

Sets the show state and the restored, minimized, and maximized positions of the specified window.

SetWindowPlacement ( IntPtr windowHandle, int left, int top, int height, int width ) : void

Sets the current position and size of the specified window.

SetWindowText ( IntPtr windowHandle, string title ) : void

Sets the text of the specified window's title bar.

ShowWindow ( IntPtr windowHandle, WindowStates state ) : bool

Sets the specified window's show state.

Method Details

EnumAllWindows() public static method

Enumerates all the windows on the screen.
public static EnumAllWindows ( ) : IEnumerable
return IEnumerable

EnumChildWindows() public static method

Enumerates recursively all the child windows that belong to the specified parent window.
public static EnumChildWindows ( IntPtr parentHandle ) : IEnumerable
parentHandle System.IntPtr The parent window handle.
return IEnumerable

EnumTopLevelWindows() public static method

Enumerates all top-level windows on the screen. This function does not search child windows.
public static EnumTopLevelWindows ( ) : IEnumerable
return IEnumerable

FlashWindow() public static method

Flashes the specified window one time. It does not change the active state of the window. To flash the window a specified number of times, use the FlashWindowEx(IntPtr, FlashWindowFlags, uint, TimeSpan) function.
public static FlashWindow ( IntPtr windowHandle ) : bool
windowHandle System.IntPtr A handle to the window to be flashed. The window can be either open or minimized.
return bool

FlashWindowEx() public static method

Flashes the specified window. It does not change the active state of the window. The function uses the default cursor blink rate.
public static FlashWindowEx ( IntPtr windowHandle, FlashWindowFlags flags ) : void
windowHandle System.IntPtr A handle to the window to be flashed. The window can be either opened or minimized.
flags FlashWindowFlags The flash status.
return void

FlashWindowEx() public static method

Flashes the specified window. It does not change the active state of the window. The function uses the default cursor blink rate.
public static FlashWindowEx ( IntPtr windowHandle, FlashWindowFlags flags, uint count ) : void
windowHandle System.IntPtr A handle to the window to be flashed. The window can be either opened or minimized.
flags FlashWindowFlags The flash status.
count uint The number of times to flash the window.
return void

FlashWindowEx() public static method

Flashes the specified window. It does not change the active state of the window.
public static FlashWindowEx ( IntPtr windowHandle, FlashWindowFlags flags, uint count, System.TimeSpan timeout ) : void
windowHandle System.IntPtr A handle to the window to be flashed. The window can be either opened or minimized.
flags FlashWindowFlags The flash status.
count uint The number of times to flash the window.
timeout System.TimeSpan The rate at which the window is to be flashed.
return void

GetClassName() public static method

Retrieves the name of the class to which the specified window belongs.
public static GetClassName ( IntPtr windowHandle ) : string
windowHandle System.IntPtr A handle to the window and, indirectly, the class to which the window belongs.
return string

GetForegroundWindow() public static method

Retrieves a handle to the foreground window (the window with which the user is currently working).
public static GetForegroundWindow ( ) : IntPtr
return System.IntPtr

GetSystemMetrics() public static method

Retrieves the specified system metric or system configuration setting.
public static GetSystemMetrics ( SystemMetrics metric ) : int
metric SystemMetrics The system metric or configuration setting to be retrieved.
return int

GetWindowPlacement() public static method

Retrieves the show state and the restored, minimized, and maximized positions of the specified window.
public static GetWindowPlacement ( IntPtr windowHandle ) : WindowPlacement
windowHandle System.IntPtr A handle to the window.
return Binarysharp.MemoryManagement.Native.WindowPlacement

GetWindowProcessId() public static method

Retrieves the identifier of the process that created the window.
public static GetWindowProcessId ( IntPtr windowHandle ) : int
windowHandle System.IntPtr A handle to the window.
return int

GetWindowText() public static method

Gets the text of the specified window's title bar.
public static GetWindowText ( IntPtr windowHandle ) : string
windowHandle System.IntPtr A handle to the window containing the text.
return string

GetWindowThreadId() public static method

Retrieves the identifier of the thread that created the specified window.
public static GetWindowThreadId ( IntPtr windowHandle ) : int
windowHandle System.IntPtr A handle to the window.
return int

MapVirtualKey() public static method

Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx function.
public static MapVirtualKey ( Keys key, TranslationTypes translation ) : uint
key Keys /// The virtual key code for a key. How this value is interpreted depends on the value of the uMapType parameter. ///
translation TranslationTypes /// The translation to be performed. The value of this parameter depends on the value of the uCode parameter. ///
return uint

MapVirtualKey() public static method

Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code. To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx function.
public static MapVirtualKey ( uint key, TranslationTypes translation ) : uint
key uint /// The virtual key code or scan code for a key. How this value is interpreted depends on the value of the uMapType parameter. ///
translation TranslationTypes /// The translation to be performed. The value of this parameter depends on the value of the uCode parameter. ///
return uint

PostMessage() public static method

Places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.
public static PostMessage ( IntPtr windowHandle, WindowsMessages message, UIntPtr wParam, UIntPtr lParam ) : void
windowHandle System.IntPtr A handle to the window whose window procedure is to receive the message. The following values have special meanings.
message WindowsMessages The message to be posted.
wParam System.UIntPtr Additional message-specific information.
lParam System.UIntPtr Additional message-specific information.
return void

PostMessage() public static method

Places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.
public static PostMessage ( IntPtr windowHandle, uint message, UIntPtr wParam, UIntPtr lParam ) : void
windowHandle System.IntPtr A handle to the window whose window procedure is to receive the message. The following values have special meanings.
message uint The message to be posted.
wParam System.UIntPtr Additional message-specific information.
lParam System.UIntPtr Additional message-specific information.
return void

SendInput() public static method

Synthesizes keystrokes, mouse motions, and button clicks.
public static SendInput ( Input inputs ) : void
inputs Binarysharp.MemoryManagement.Native.Input An array of structures. Each structure represents an event to be inserted into the keyboard or mouse input stream.
return void

SendMessage() public static method

Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
public static SendMessage ( IntPtr windowHandle, WindowsMessages message, UIntPtr wParam, IntPtr lParam ) : IntPtr
windowHandle System.IntPtr A handle to the window whose window procedure will receive the message.
message WindowsMessages The message to be sent.
wParam System.UIntPtr Additional message-specific information.
lParam System.IntPtr Additional message-specific information.
return System.IntPtr

SendMessage() public static method

Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
public static SendMessage ( IntPtr windowHandle, uint message, UIntPtr wParam, IntPtr lParam ) : IntPtr
windowHandle System.IntPtr A handle to the window whose window procedure will receive the message.
message uint The message to be sent.
wParam System.UIntPtr Additional message-specific information.
lParam System.IntPtr Additional message-specific information.
return System.IntPtr

SetForegroundWindow() public static method

Brings the thread that created the specified window into the foreground and activates the window. The window is restored if minimized. Performs no action if the window is already activated.
public static SetForegroundWindow ( IntPtr windowHandle ) : void
windowHandle System.IntPtr A handle to the window that should be activated and brought to the foreground.
return void

SetWindowPlacement() public static method

Sets the show state and the restored, minimized, and maximized positions of the specified window.
public static SetWindowPlacement ( IntPtr windowHandle, WindowPlacement placement ) : void
windowHandle System.IntPtr A handle to the window.
placement Binarysharp.MemoryManagement.Native.WindowPlacement A pointer to the structure that specifies the new show state and window positions.
return void

SetWindowPlacement() public static method

Sets the current position and size of the specified window.
public static SetWindowPlacement ( IntPtr windowHandle, int left, int top, int height, int width ) : void
windowHandle System.IntPtr A handle to the window.
left int The x-coordinate of the upper-left corner of the window.
top int The y-coordinate of the upper-left corner of the window.
height int The height of the window.
width int The width of the window.
return void

SetWindowText() public static method

Sets the text of the specified window's title bar.
public static SetWindowText ( IntPtr windowHandle, string title ) : void
windowHandle System.IntPtr A handle to the window whose text is to be changed.
title string The new title text.
return void

ShowWindow() public static method

Sets the specified window's show state.
public static ShowWindow ( IntPtr windowHandle, WindowStates state ) : bool
windowHandle System.IntPtr A handle to the window.
state WindowStates Controls how the window is to be shown.
return bool