Table of Contents

Class Win32

Namespace
Ranorex.Core.WinApi
Assembly
Ranorex.Core.WinApi.dll
public class Win32
Inheritance
Win32
Inherited Members

Fields

InvalidProcessId

public const int InvalidProcessId = 0

Field Value

int

InvalidWindowHandle

public static readonly IntPtr InvalidWindowHandle

Field Value

IntPtr

Properties

ForegroundWindow

public static IntPtr ForegroundWindow { get; set; }

Property Value

IntPtr

Methods

AttachThreadInput(uint, uint, bool)

public static bool AttachThreadInput(uint idAttach, uint idAttachTo, bool attach)

Parameters

idAttach uint
idAttachTo uint
attach bool

Returns

bool

BringToForeground(IntPtr)

public static bool BringToForeground(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

bool

CloseWindow(IntPtr)

public static void CloseWindow(IntPtr hwnd)

Parameters

hwnd IntPtr

CloseWindowSysCommand(IntPtr)

public static void CloseWindowSysCommand(IntPtr hwnd)

Parameters

hwnd IntPtr

DeepestDescendantFromPoint(Point, IntPtr)

public static IntPtr DeepestDescendantFromPoint(Point point, IntPtr parent)

Parameters

point Point
parent IntPtr

Returns

IntPtr

DestroyIconHandle(IntPtr)

public static void DestroyIconHandle(IntPtr handle)

Parameters

handle IntPtr

EnumChildWindows(IntPtr, EnumWindowsProc, object)

public static bool EnumChildWindows(IntPtr hWndParent, Win32.EnumWindowsProc lpEnumFunc, object state)

Parameters

hWndParent IntPtr
lpEnumFunc Win32.EnumWindowsProc
state object

Returns

bool

FindWindow(string, string)

public static IntPtr FindWindow(string className, string title)

Parameters

className string
title string

Returns

IntPtr

FindWindowEx(IntPtr, IntPtr, string, string)

public static IntPtr FindWindowEx(IntPtr parent, IntPtr childAfter, string className, string title)

Parameters

parent IntPtr
childAfter IntPtr
className string
title string

Returns

IntPtr

GetAncestor(IntPtr, GetAncestorFlag)

public static IntPtr GetAncestor(IntPtr hwnd, Win32.GetAncestorFlag gaFlags)

Parameters

hwnd IntPtr
gaFlags Win32.GetAncestorFlag

Returns

IntPtr

GetClassName(IntPtr)

public static string GetClassName(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

string

GetClientRect(IntPtr, out Rectangle)

public static bool GetClientRect(IntPtr hWnd, out Rectangle rect)

Parameters

hWnd IntPtr
rect Rectangle

Returns

bool

GetClientScreenRectangle(IntPtr)

public static Rectangle GetClientScreenRectangle(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

Rectangle

GetCurrentProcessId()

public static int GetCurrentProcessId()

Returns

int

GetCurrentSessionId()

public static int GetCurrentSessionId()

Returns

int

GetDesktopWindow()

public static IntPtr GetDesktopWindow()

Returns

IntPtr

GetDlgCtrlID(IntPtr)

public static int GetDlgCtrlID(IntPtr hwndCtl)

Parameters

hwndCtl IntPtr

Returns

int

GetExitCodeProcess(SafeWaitHandle)

public static int GetExitCodeProcess(SafeWaitHandle procHandle)

Parameters

procHandle SafeWaitHandle

Returns

int

GetFocus()

public static IntPtr GetFocus()

Returns

IntPtr

GetForegroundWindow()

public static IntPtr GetForegroundWindow()

Returns

IntPtr

GetInstance(IntPtr)

public static int GetInstance(IntPtr hwnd)

Parameters

hwnd IntPtr

Returns

int

GetInstance(IntPtr, bool, bool)

public static int GetInstance(IntPtr hwnd, bool onlyVisible, bool sortByGeometry)

Parameters

hwnd IntPtr
onlyVisible bool
sortByGeometry bool

Returns

int

GetLastActivePopup(IntPtr)

public static IntPtr GetLastActivePopup(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

IntPtr

GetMemoryStatistics(out int, out long, out long, out long, out long)

public static void GetMemoryStatistics(out int memLoad, out long memTotalVirt, out long memTotalPhys, out long memFreeVirt, out long memFreePhys)

Parameters

memLoad int
memTotalVirt long
memTotalPhys long
memFreeVirt long
memFreePhys long

GetModuleHandle(string)

public static IntPtr GetModuleHandle(string lpModuleName)

Parameters

lpModuleName string

Returns

IntPtr

GetRawInstance(IntPtr)

public static int GetRawInstance(IntPtr hwnd)

Parameters

hwnd IntPtr

Returns

int

GetShieldIcon()

public static Icon GetShieldIcon()

Returns

Icon

GetShortFileName(string)

public static string GetShortFileName(string filePath)

Parameters

filePath string

Returns

string

GetWindow(IntPtr, GetWindowCommand)

public static IntPtr GetWindow(IntPtr hWnd, Win32.GetWindowCommand uCmd)

Parameters

hWnd IntPtr
uCmd Win32.GetWindowCommand

Returns

IntPtr

GetWindowBigIcon(IntPtr)

public static Icon GetWindowBigIcon(IntPtr handle)

Parameters

handle IntPtr

Returns

Icon

GetWindowExtendedStyle(IntPtr)

public static Win32.WindowExtendedStyles GetWindowExtendedStyle(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

Win32.WindowExtendedStyles

GetWindowIcon(IntPtr, int)

public static Icon GetWindowIcon(IntPtr handle, int iconSize)

Parameters

handle IntPtr
iconSize int

Returns

Icon

GetWindowLongPtr(IntPtr, GetWindowLongPtrNIndex)

public static IntPtr GetWindowLongPtr(IntPtr hWnd, Win32.GetWindowLongPtrNIndex nIndex)

Parameters

hWnd IntPtr
nIndex Win32.GetWindowLongPtrNIndex

Returns

IntPtr

GetWindowRect(IntPtr, out Rectangle)

public static bool GetWindowRect(IntPtr hWnd, out Rectangle rect)

Parameters

hWnd IntPtr
rect Rectangle

Returns

bool

GetWindowSmallIcon(IntPtr)

public static Icon GetWindowSmallIcon(IntPtr handle)

Parameters

handle IntPtr

Returns

Icon

GetWindowState(IntPtr)

public static FormWindowState GetWindowState(IntPtr hwnd)

Parameters

hwnd IntPtr

Returns

FormWindowState

GetWindowStyle(IntPtr)

public static Win32.WindowStyles GetWindowStyle(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

Win32.WindowStyles

GetWindowText(IntPtr)

public static string GetWindowText(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

string

GetWindowThreadProcessId(IntPtr, out int)

public static uint GetWindowThreadProcessId(IntPtr hWnd, out int processId)

Parameters

hWnd IntPtr
processId int

Returns

uint

GetWindowsProductType()

public static Win32.WindowsProductType GetWindowsProductType()

Returns

Win32.WindowsProductType

HasFocus(IntPtr)

public static bool HasFocus(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

bool

HasUiAccess()

public static bool HasUiAccess()

Returns

bool

InvalidateRect(IntPtr, Rectangle, bool)

public static bool InvalidateRect(IntPtr hWnd, Rectangle rect, bool bErase)

Parameters

hWnd IntPtr
rect Rectangle
bErase bool

Returns

bool

IsAncestorOrSelf(IntPtr, IntPtr)

public static bool IsAncestorOrSelf(IntPtr filterWnd, IntPtr testWnd)

Parameters

filterWnd IntPtr
testWnd IntPtr

Returns

bool

IsAppHung(IntPtr)

public static bool IsAppHung(IntPtr hwnd)

Parameters

hwnd IntPtr

Returns

bool

IsCurrentProcessElevated()

public static bool IsCurrentProcessElevated()

Returns

bool

IsIconic(IntPtr)

public static bool IsIconic(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

bool

IsImmersiveProcess(int)

public static bool? IsImmersiveProcess(int processId)

Parameters

processId int

Returns

bool?

IsMenu(IntPtr)

public static bool IsMenu(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

bool

IsWin8OrLater()

public static bool IsWin8OrLater()

Returns

bool

IsWindow(IntPtr)

public static bool IsWindow(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

bool

IsWindowProcessingMessages(IntPtr)

public static bool IsWindowProcessingMessages(IntPtr hwnd)

Parameters

hwnd IntPtr

Returns

bool

IsWow64Process()

public static bool IsWow64Process()

Returns

bool

IsWow64Process(int)

public static bool? IsWow64Process(int processId)

Parameters

processId int

Returns

bool?

IsWow64Window(IntPtr)

public static bool? IsWow64Window(IntPtr hwnd)

Parameters

hwnd IntPtr

Returns

bool?

MakeTopMostWithoutActivate(IntPtr)

public static void MakeTopMostWithoutActivate(IntPtr hwnd)

Parameters

hwnd IntPtr

MoveWindow(IntPtr, int, int, int, int, bool)

public static bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint)

Parameters

hWnd IntPtr
x int
y int
width int
height int
repaint bool

Returns

bool

ObjectFromLresult(IntPtr, ref Guid, IntPtr)

public static object ObjectFromLresult(IntPtr lResult, ref Guid riid, IntPtr wParam)

Parameters

lResult IntPtr
riid Guid
wParam IntPtr

Returns

object

PointsToPixels(float)

public static int PointsToPixels(float points)

Parameters

points float

Returns

int

PostMessage(IntPtr, uint, IntPtr, IntPtr)

public static bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam)

Parameters

hWnd IntPtr
Msg uint
wParam IntPtr
lParam IntPtr

Returns

bool

RegisterWindowMessage(string)

public static uint RegisterWindowMessage(string lpString)

Parameters

lpString string

Returns

uint

RunProcessWithNormalUserIntegrityLevel(string, string, out SafeWaitHandle, out SafeFileHandle, out SafeFileHandle)

public static int RunProcessWithNormalUserIntegrityLevel(string fileName, string cmdLine, out SafeWaitHandle procHandle, out SafeFileHandle stdOutReadHandle, out SafeFileHandle stdOutWriteHandle)

Parameters

fileName string
cmdLine string
procHandle SafeWaitHandle
stdOutReadHandle SafeFileHandle
stdOutWriteHandle SafeFileHandle

Returns

int

RunProcessWithNormalUserIntegrityLevel(string, string, string, bool, out SafeWaitHandle, out SafeFileHandle, out SafeFileHandle)

public static int RunProcessWithNormalUserIntegrityLevel(string fileName, string cmdLine, string currentDir, bool maximized, out SafeWaitHandle procHandle, out SafeFileHandle stdOutReadHandle, out SafeFileHandle stdOutWriteHandle)

Parameters

fileName string
cmdLine string
currentDir string
maximized bool
procHandle SafeWaitHandle
stdOutReadHandle SafeFileHandle
stdOutWriteHandle SafeFileHandle

Returns

int

SendMessageWithTimeout(IntPtr, uint, IntPtr, IntPtr, SendMessageTimeoutFuFlags, uint, out IntPtr)

public static bool SendMessageWithTimeout(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam, Win32.SendMessageTimeoutFuFlags fuFlags, uint uTimeout, out IntPtr result)

Parameters

hWnd IntPtr
Msg uint
wParam IntPtr
lParam IntPtr
fuFlags Win32.SendMessageTimeoutFuFlags
uTimeout uint
result IntPtr

Returns

bool

SetComboboxHeight(IntPtr, int)

public static void SetComboboxHeight(IntPtr handle, int height)

Parameters

handle IntPtr
height int

SetFocus(IntPtr)

public static void SetFocus(IntPtr hWnd)

Parameters

hWnd IntPtr

SetForegroundWindow(IntPtr)

public static bool SetForegroundWindow(IntPtr hWnd)

Parameters

hWnd IntPtr

Returns

bool

SetProcessDPIAware()

public static bool SetProcessDPIAware()

Returns

bool

SetWindowPos(IntPtr, IntPtr, int, int, int, int, SetWindowPosFlags)

public static bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int width, int height, Win32.SetWindowPosFlags flags)

Parameters

hWnd IntPtr
hWndInsertAfter IntPtr
x int
y int
width int
height int
flags Win32.SetWindowPosFlags

Returns

bool

SetWindowText(IntPtr, string)

public static bool SetWindowText(IntPtr hWnd, string text)

Parameters

hWnd IntPtr
text string

Returns

bool

ShowElevationIconOnButton(IntPtr)

public static bool ShowElevationIconOnButton(IntPtr buttonHandle)

Parameters

buttonHandle IntPtr

Returns

bool

ShowWindow(IntPtr, ShowWindowCommand)

public static bool ShowWindow(IntPtr hWnd, Win32.ShowWindowCommand nCmdShow)

Parameters

hWnd IntPtr
nCmdShow Win32.ShowWindowCommand

Returns

bool

WindowFromPoint(Point, bool)

public static IntPtr WindowFromPoint(Point point, bool withWorkaround)

Parameters

point Point
withWorkaround bool

Returns

IntPtr

WindowFromPoint(Point, IntPtr, bool)

public static IntPtr WindowFromPoint(Point point, IntPtr parent, bool withWorkaround)

Parameters

point Point
parent IntPtr
withWorkaround bool

Returns

IntPtr

WindowFromPointEx(Point, IntPtr)

public static IntPtr WindowFromPointEx(Point point, IntPtr parent)

Parameters

point Point
parent IntPtr

Returns

IntPtr