Class User32Api
Native wrappers for the User32 DLL
Inheritance
Namespace: Dapplo.Windows.User32
Assembly: Dapplo.Windows.User32.dll
Syntax
public static class User32Api : object
Methods
| Improve this Doc View SourceAllDisplays()
Returns the number of Displays using the Win32 functions
Declaration
public static IEnumerable<DisplayInfo> AllDisplays()
Returns
| Type | Description |
|---|---|
| IEnumerable<DisplayInfo> | collection of Display Info |
BringWindowToTop(IntPtr)
Bring the specified window to the front
Declaration
public static bool BringWindowToTop(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr specifying the hWnd |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the call was successfull |
ChangeClipboardChain(IntPtr, IntPtr)
Declaration
public static bool ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWndRemove | |
| IntPtr | hWndNewNext |
Returns
| Type | Description |
|---|---|
| System.Boolean |
CopyIcon(IntPtr)
The following is used for Icon handling, and copies a hicon to a new
Declaration
public static SafeIconHandle CopyIcon(IntPtr hIcon)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hIcon | IntPtr |
Returns
| Type | Description |
|---|---|
| SafeIconHandle | SafeIconHandle |
CreateIconIndirect(ref IconInfo)
Declaration
public static IntPtr CreateIconIndirect(ref IconInfo icon)
Parameters
| Type | Name | Description |
|---|---|---|
| IconInfo | icon |
Returns
| Type | Description |
|---|---|
| IntPtr |
CreateWin32Exception(String)
Helper method to create a Win32 exception with the windows message in it
Declaration
public static Exception CreateWin32Exception(string method)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | method | string with current method |
Returns
| Type | Description |
|---|---|
| Exception | Exception |
DestroyIcon(IntPtr)
Declaration
public static bool DestroyIcon(IntPtr hIcon)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hIcon |
Returns
| Type | Description |
|---|---|
| System.Boolean |
EnumChildWindows(IntPtr, User32Api.EnumWindowsProc, IntPtr)
See here
Declaration
public static bool EnumChildWindows(IntPtr hWndParent, User32Api.EnumWindowsProc enumFunc, IntPtr param)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWndParent | IntPtr with hwnd of parent window, if this is IntPtr.Zero this function behaves as EnumWindows |
| User32Api.EnumWindowsProc | enumFunc | EnumWindowsProc |
| IntPtr | param | An application-defined value to be passed to the callback function. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if success |
EnumThreadWindows(Int32, User32Api.EnumWindowsProc, IntPtr)
See EnumThreadWindows function Enumerates all nonchild windows associated with a thread by passing the handle to each window, in turn, to an application-defined callback function. EnumThreadWindows continues until the last window is enumerated or the callback function returns FALSE. To enumerate child windows of a particular window, use the EnumChildWindows function.
Declaration
public static bool EnumThreadWindows(int threadId, User32Api.EnumWindowsProc enumFunc, IntPtr param)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | threadId | The identifier of the thread whose windows are to be enumerated. |
| User32Api.EnumWindowsProc | enumFunc | EnumWindowsProc |
| IntPtr | param | An application-defined value to be passed to the callback function. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
EnumWindows(User32Api.EnumWindowsProc, IntPtr)
See here
Declaration
public static bool EnumWindows(User32Api.EnumWindowsProc enumFunc, IntPtr param)
Parameters
| Type | Name | Description |
|---|---|---|
| User32Api.EnumWindowsProc | enumFunc | EnumWindowsProc |
| IntPtr | param | An application-defined value to be passed to the callback function. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if success |
FindWindow(String, String)
Declaration
public static IntPtr FindWindow(string lpClassName, string lpWindowName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | lpClassName | |
| System.String | lpWindowName |
Returns
| Type | Description |
|---|---|
| IntPtr |
FindWindowEx(IntPtr, IntPtr, String, String)
Declaration
public static IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwndParent | |
| IntPtr | hwndChildAfter | |
| System.String | lpszClass | |
| System.String | lpszWindow |
Returns
| Type | Description |
|---|---|
| IntPtr |
GetClassLongWrapper(IntPtr, ClassLongIndex)
Wrapper for the GetClassLong which decides if the system is 64-bit or not and calls the right one.
Declaration
public static IntPtr GetClassLongWrapper(IntPtr hWnd, ClassLongIndex index)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr |
| ClassLongIndex | index | ClassLongIndex |
Returns
| Type | Description |
|---|---|
| IntPtr | IntPtr |
GetClassname(IntPtr)
Retrieve the windows classname
Declaration
public static string GetClassname(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr for the window |
Returns
| Type | Description |
|---|---|
| System.String | string |
GetClassName(IntPtr, StringBuilder, Int32)
Get the classname of the specified window
Declaration
public static int GetClassName(IntPtr hWnd, StringBuilder className, int nMaxCount)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr with the hWnd |
| StringBuilder | className | StringBuilder to place the classname into |
| System.Int32 | nMaxCount | max size for the string builder length |
Returns
| Type | Description |
|---|---|
| System.Int32 | nr of characters returned |
GetClipboardOwner()
Declaration
public static IntPtr GetClipboardOwner()
Returns
| Type | Description |
|---|---|
| IntPtr |
GetCursorInfo(out CursorInfo)
See GetCursorInfo function Retrieves information about the global cursor.
Declaration
public static bool GetCursorInfo(out CursorInfo cursorInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| CursorInfo | cursorInfo | a CURSORINFO structure |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool |
GetCursorLocation()
Retrieves the cursor location safely, accounting for DPI settings in Vista/Windows 7.
Declaration
public static POINT GetCursorLocation()
Returns
| Type | Description |
|---|---|
| POINT | POINT with cursor location, relative to the origin of the monitor setup (i.e. negative coordinates arepossible in multiscreen setups) |
GetDC(IntPtr)
Declaration
public static IntPtr GetDC(IntPtr hwnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd |
Returns
| Type | Description |
|---|---|
| IntPtr |
GetDesktopWindow()
Get the hWnd of the Desktop window
Declaration
public static IntPtr GetDesktopWindow()
Returns
| Type | Description |
|---|---|
| IntPtr | IntPtr |
GetForegroundWindow()
Declaration
public static IntPtr GetForegroundWindow()
Returns
| Type | Description |
|---|---|
| IntPtr |
GetGuiResources(IntPtr, UInt32)
Declaration
public static uint GetGuiResources(IntPtr hProcess, uint uiFlags)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hProcess | |
| System.UInt32 | uiFlags |
Returns
| Type | Description |
|---|---|
| System.UInt32 |
GetGuiResourcesGdiCount()
Return the count of GDI objects.
Declaration
public static uint GetGuiResourcesGdiCount()
Returns
| Type | Description |
|---|---|
| System.UInt32 | Return the count of GDI objects. |
GetGuiResourcesUserCount()
Return the count of USER objects.
Declaration
public static uint GetGuiResourcesUserCount()
Returns
| Type | Description |
|---|---|
| System.UInt32 | Return the count of USER objects. |
GetIcon(IntPtr, Boolean)
Get the icon for a hWnd
Declaration
public static Icon GetIcon(IntPtr hWnd, bool useLargeIcons = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr |
| System.Boolean | useLargeIcons | true to try to get a big icon first |
Returns
| Type | Description |
|---|---|
| Icon | System.Drawing.Icon |
GetIconInfo(SafeIconHandle, out IconInfo)
Declaration
public static bool GetIconInfo(SafeIconHandle iconHandle, out IconInfo iconInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| SafeIconHandle | iconHandle | |
| IconInfo | iconInfo |
Returns
| Type | Description |
|---|---|
| System.Boolean |
GetParent(IntPtr)
Retrieves a handle to the specified window's parent or owner. To retrieve a handle to a specified ancestor, use the GetAncestor function.
Declaration
public static IntPtr GetParent(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | A handle to the window whose parent window handle is to be retrieved. |
Returns
| Type | Description |
|---|---|
| IntPtr | IntPtr handle to the parent window or IntPtr.Zero if none If the window is a child window, the return value is a handle to the parent window. If the window is a top-level window with the WS_POPUP style, the return value is a handle to the owner window. |
GetScrollBarInfo(IntPtr, ObjectIdentifiers, ref ScrollBarInfo)
See GetScrollBarInfo function for more information.
Declaration
public static bool GetScrollBarInfo(IntPtr hwnd, ObjectIdentifiers idObject, ref ScrollBarInfo scrollBarInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd | Handle to a window associated with the scroll bar whose information is to be retrieved. If the idObject parameter is OBJID_CLIENT, hwnd is a handle to a scroll bar control. Otherwise, hwnd is a handle to a window created with WS_VSCROLL and/or WS_HSCROLL style. |
| ObjectIdentifiers | idObject | Specifies the scroll bar object. Can be ObjectIdentifiers.Client, ObjectIdentifiers.HorizontalScrollbar, ObjectIdentifiers.VerticalScrollbar |
| ScrollBarInfo | scrollBarInfo | ScrollBarInfo ref |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool |
GetScrollInfo(IntPtr, ScrollBarTypes, ref ScrollInfo)
See GetScrollInfo for more information.
Declaration
public static bool GetScrollInfo(IntPtr hwnd, ScrollBarTypes scrollBar, ref ScrollInfo scrollInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd | IntPtr with the window handle |
| ScrollBarTypes | scrollBar | ScrollBarTypes |
| ScrollInfo | scrollInfo | ScrollInfo ref |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool if it worked |
GetSysColor(Int32)
Declaration
public static uint GetSysColor(int nIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | nIndex |
Returns
| Type | Description |
|---|---|
| System.UInt32 |
GetSystemMetrics(SystemMetric)
Declaration
public static int GetSystemMetrics(SystemMetric index)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemMetric | index | SystemMetric |
Returns
| Type | Description |
|---|---|
| System.Int32 | int |
GetText(IntPtr)
Retrieve the windows caption, also called Text
Declaration
public static string GetText(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr for the window |
Returns
| Type | Description |
|---|---|
| System.String | string |
GetTextFromWindow(IntPtr)
Get the text of a control, this is not the caption
Declaration
public static string GetTextFromWindow(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr |
Returns
| Type | Description |
|---|---|
| System.String | string with the text |
GetTitleBarInfoEx(IntPtr)
Get the titlebar info ex for the specified window
Declaration
public static TitleBarInfoEx GetTitleBarInfoEx(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr with the window handle |
Returns
| Type | Description |
|---|---|
| TitleBarInfoEx | TitleBarInfoEx |
GetTopWindow(IntPtr)
Declaration
public static IntPtr GetTopWindow(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd |
Returns
| Type | Description |
|---|---|
| IntPtr |
GetWindow(IntPtr, GetWindowCommands)
Retrieves a handle to a window that has the specified relationship (Z-Order or owner) to the specified window. See GetWindow function
Declaration
public static IntPtr GetWindow(IntPtr hWnd, GetWindowCommands getWindowCommand)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr A handle to a window. The window handle retrieved is relative to this window, based on the value of the uCmd parameter. |
| GetWindowCommands | getWindowCommand | GetWindowCommands The relationship between the specified window and the window whose handle is to be retrieved. See GetWindowCommands |
Returns
| Type | Description |
|---|---|
| IntPtr |
GetWindowInfo(IntPtr, ref WindowInfo)
See GetWindowInfo Retrieves information about the specified window.
Declaration
public static bool GetWindowInfo(IntPtr hwnd, ref WindowInfo windowInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd | IntPtr |
| WindowInfo | windowInfo | WindowInfo (use WindowInfo.Create) |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool if false than get the last error |
GetWindowLongWrapper(IntPtr, WindowLongIndex)
Wrapper for the GetWindowLong which decides if the system is 64-bit or not and calls the right one.
Declaration
public static long GetWindowLongWrapper(IntPtr hwnd, WindowLongIndex index)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd | IntPtr |
| WindowLongIndex | index | WindowLongIndex |
Returns
| Type | Description |
|---|---|
| System.Int64 |
GetWindowPlacement(IntPtr, ref WindowPlacement)
Get the WindowPlacement for the specified window
Declaration
public static bool GetWindowPlacement(IntPtr hWnd, ref WindowPlacement windowPlacement)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr |
| WindowPlacement | windowPlacement | WindowPlacement |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if success |
GetWindowRgn(IntPtr, SafeHandle)
Declaration
public static RegionResults GetWindowRgn(IntPtr hWnd, SafeHandle hRgn)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr |
| SafeHandle | hRgn | SafeHandle |
Returns
| Type | Description |
|---|---|
| RegionResults | RegionResults |
GetWindowTextLength(IntPtr)
Declaration
public static int GetWindowTextLength(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd |
Returns
| Type | Description |
|---|---|
| System.Int32 |
GetWindowThreadProcessId(IntPtr, out Int32)
Declaration
public static int GetWindowThreadProcessId(IntPtr hWnd, out int processId)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | |
| System.Int32 | processId |
Returns
| Type | Description |
|---|---|
| System.Int32 |
IsIconic(IntPtr)
Return true if the specified window is minimized
Declaration
public static bool IsIconic(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr for the hWnd |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if minimized |
IsWindow(IntPtr)
Determines whether the specified window handle identifies an existing window.
Declaration
public static bool IsWindow(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | A handle to the window to be tested. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If the window handle identifies an existing window, the return value is true. If the window handle does not identify an existing window, the return value is false. |
IsWindowVisible(IntPtr)
Determines the visibility state of the specified window.
Declaration
public static bool IsWindowVisible(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | A handle to the window to be tested. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If the specified window, its parent window, its parent's parent window, and so forth, have the WS_VISIBLE style, the return value is nonzero. Otherwise, the return value is zero. Because the return value specifies whether the window has the WS_VISIBLE style, it may be nonzero even if the window is totally obscured by other windows. Remarks: The visibility state of a window is indicated by the WS_VISIBLE style bit. When WS_VISIBLE is set, the window is displayed and subsequent drawing into it is displayed as long as the window has the WS_VISIBLE style. Any drawing to a window with the WS_VISIBLE style will not be displayed if the window is obscured by other windows or is clipped by its parent window. |
IsZoomed(IntPtr)
Return true if the specified window is maximized
Declaration
public static bool IsZoomed(IntPtr hwnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd | IntPtr for the hWnd |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if maximized |
MapWindowPoints(IntPtr, IntPtr, ref POINT, Int32)
Declaration
public static int MapWindowPoints(IntPtr hwndFrom, IntPtr hwndTo, ref POINT lpPoints, int cPoints)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwndFrom | |
| IntPtr | hwndTo | |
| POINT | lpPoints | |
| System.Int32 | cPoints |
Returns
| Type | Description |
|---|---|
| System.Int32 |
MonitorFromRect(ref RECT, MonitorFrom)
The MonitorFromRect function retrieves a handle to the display monitor that has the largest area of intersection with a specified rectangle. see MonitorFromRect function
Declaration
public static IntPtr MonitorFromRect(ref RECT rect, MonitorFrom monitorFrom)
Parameters
| Type | Name | Description |
|---|---|---|
| RECT | rect | A RECT structure that specifies the rectangle of interest in virtual-screen coordinates. |
| MonitorFrom | monitorFrom | MonitorFromRectFlags |
Returns
| Type | Description |
|---|---|
| IntPtr | HMONITOR handle |
MonitorFromWindow(IntPtr, MonitorFrom)
See MonitorFromWindow function The MonitorFromWindow function retrieves a handle to the display monitor that has the largest area of intersection with the bounding rectangle of a specified window.
Declaration
public static IntPtr MonitorFromWindow(IntPtr hwnd, MonitorFrom monitorFrom)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd | |
| MonitorFrom | monitorFrom | MonitorFromFlags |
Returns
| Type | Description |
|---|---|
| IntPtr | IntPtr for the monitor |
PrintWindow(IntPtr, IntPtr, PrintWindowFlags)
Declaration
public static bool PrintWindow(IntPtr hwnd, IntPtr hDc, PrintWindowFlags printWindowFlags)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd | IntPtr |
| IntPtr | hDc | IntPtr |
| PrintWindowFlags | printWindowFlags | PrintWindowFlags |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool |
ReleaseCapture()
Declaration
public static bool ReleaseCapture()
Returns
| Type | Description |
|---|---|
| System.Boolean |
ReleaseDC(IntPtr, IntPtr)
Declaration
public static bool ReleaseDC(IntPtr hWnd, IntPtr hDC)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | |
| IntPtr | hDC |
Returns
| Type | Description |
|---|---|
| System.Boolean |
SendMessage(IntPtr, WindowsMessages, ScrollBarCommands, Int32)
Used for WM_VSCROLL and WM_HSCROLL
Declaration
public static int SendMessage(IntPtr hWnd, WindowsMessages windowsMessage, ScrollBarCommands scrollBarCommand, int lParam)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr |
| WindowsMessages | windowsMessage | WindowsMessages |
| ScrollBarCommands | scrollBarCommand | ScrollBarCommands |
| System.Int32 | lParam |
Returns
| Type | Description |
|---|---|
| System.Int32 | 0 |
SendMessage(IntPtr, WindowsMessages, SysCommands, IntPtr)
Declaration
public static IntPtr SendMessage(IntPtr hWnd, WindowsMessages windowsMessage, SysCommands sysCommand, IntPtr lParam)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | |
| WindowsMessages | windowsMessage | |
| SysCommands | sysCommand | |
| IntPtr | lParam |
Returns
| Type | Description |
|---|---|
| IntPtr |
SendMessage(IntPtr, WindowsMessages, IntPtr, IntPtr)
Declaration
public static IntPtr SendMessage(IntPtr hWnd, WindowsMessages windowsMessage, IntPtr wParam, IntPtr lParam)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | |
| WindowsMessages | windowsMessage | |
| IntPtr | wParam | |
| IntPtr | lParam |
Returns
| Type | Description |
|---|---|
| IntPtr |
SendMessage(IntPtr, WindowsMessages, IntPtr, String)
Declaration
public static IntPtr SendMessage(IntPtr hWnd, WindowsMessages windowsMessage, IntPtr wParam, string lParam)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | |
| WindowsMessages | windowsMessage | |
| IntPtr | wParam | |
| System.String | lParam |
Returns
| Type | Description |
|---|---|
| IntPtr |
SendMessage(IntPtr, WindowsMessages, Int32, StringBuilder)
Used for WM_GETTEXT
Declaration
public static IntPtr SendMessage(IntPtr hWnd, WindowsMessages windowsMessage, int wParam, StringBuilder lParam)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr for the Window handle |
| WindowsMessages | windowsMessage | |
| System.Int32 | wParam | int with the capacity of the string builder |
| StringBuilder | lParam | StringBuilder |
Returns
| Type | Description |
|---|---|
| IntPtr |
SendMessage(IntPtr, WindowsMessages, Int32, Int32)
Used for calls where the arguments are int
Declaration
public static IntPtr SendMessage(IntPtr hWnd, WindowsMessages windowsMessage, int wParam, int lParam)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr for the Window handle |
| WindowsMessages | windowsMessage | WindowsMessages |
| System.Int32 | wParam | int |
| System.Int32 | lParam | int |
Returns
| Type | Description |
|---|---|
| IntPtr |
SendMessageTimeout(IntPtr, UInt32, IntPtr, IntPtr, SendMessageTimeoutFlags, UInt32, out UIntPtr)
Declaration
public static IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam, SendMessageTimeoutFlags fuFlags, uint uTimeout, out UIntPtr lpdwResult)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | |
| System.UInt32 | Msg | |
| IntPtr | wParam | |
| IntPtr | lParam | |
| SendMessageTimeoutFlags | fuFlags | |
| System.UInt32 | uTimeout | |
| UIntPtr | lpdwResult |
Returns
| Type | Description |
|---|---|
| IntPtr |
SetCapture(IntPtr)
Declaration
public static IntPtr SetCapture(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd |
Returns
| Type | Description |
|---|---|
| IntPtr |
SetClipboardViewer(IntPtr)
Declaration
public static IntPtr SetClipboardViewer(IntPtr hWndNewViewer)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWndNewViewer |
Returns
| Type | Description |
|---|---|
| IntPtr |
SetFocus(IntPtr)
Sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue.
Declaration
public static IntPtr SetFocus(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | A handle to the window that will receive the keyboard input. If this parameter is NULL, keystrokes are ignored. |
Returns
| Type | Description |
|---|---|
| IntPtr | IntPtr If the function succeeds, the return value is the handle to the window that previously had the keyboard focus. If the hWnd parameter is invalid or the window is not attached to the calling thread's message queue, the return value is NULL. To get extended error information, call GetLastError. |
SetForegroundWindow(IntPtr)
Set the current foreground window
Declaration
public static bool SetForegroundWindow(IntPtr hWnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr with the handle to the window |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool |
SetParent(IntPtr, IntPtr)
See SetParent function Changes the parent window of the specified child window.
Declaration
public static IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWndChild | IntPtr |
| IntPtr | hWndNewParent | IntPtr |
Returns
| Type | Description |
|---|---|
| IntPtr | If the function succeeds, the return value is a handle to the previous parent window. If the function fails, the return value is NULL. To get extended error information, call GetLastError. |
SetScrollInfo(IntPtr, ScrollBarTypes, ref ScrollInfo, Boolean)
See SetScrollInfo for more information.
Declaration
public static bool SetScrollInfo(IntPtr hwnd, ScrollBarTypes scrollBar, ref ScrollInfo scrollInfo, bool redraw)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd | IntPtr with the window handle |
| ScrollBarTypes | scrollBar | ScrollBarTypes |
| ScrollInfo | scrollInfo | ScrollInfo ref |
| System.Boolean | redraw | bool to specify if a redraw should be made |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool if it worked |
SetWindowLongWrapper(IntPtr, WindowLongIndex, IntPtr)
Wrapper for the SetWindowLong which decides if the system is 64-bit or not and calls the right one.
Declaration
public static void SetWindowLongWrapper(IntPtr hwnd, WindowLongIndex index, IntPtr styleFlags)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd | IntPtr |
| WindowLongIndex | index | WindowLongIndex |
| IntPtr | styleFlags |
SetWindowPlacement(IntPtr, ref WindowPlacement)
Set the WindowPlacement for the specified window
Declaration
public static bool SetWindowPlacement(IntPtr hWnd, ref WindowPlacement windowPlacement)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | IntPtr |
| WindowPlacement | windowPlacement | WindowPlacement |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the call was sucessfull |
SetWindowPos(IntPtr, IntPtr, Int32, Int32, Int32, Int32, WindowPos)
Declaration
public static bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, WindowPos uFlags)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | |
| IntPtr | hWndInsertAfter | |
| System.Int32 | X | |
| System.Int32 | Y | |
| System.Int32 | cx | |
| System.Int32 | cy | |
| WindowPos | uFlags |
Returns
| Type | Description |
|---|---|
| System.Boolean |
ShowScrollBar(IntPtr, ScrollBarTypes, Boolean)
See ShowScrollBar function for more information.
Declaration
public static bool ShowScrollBar(IntPtr hwnd, ScrollBarTypes scrollBar, bool show)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd | IntPtr |
| ScrollBarTypes | scrollBar | ScrollBarTypes |
| System.Boolean | show | true to show, false to hide |
Returns
| Type | Description |
|---|---|
| System.Boolean | If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. |
ShowWindow(IntPtr, ShowWindowCommands)
Declaration
public static bool ShowWindow(IntPtr hWnd, ShowWindowCommands nCmdShow)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hWnd | A handle to the window. |
| ShowWindowCommands | nCmdShow | ShowWindowCommands Controls how the window is to be shown. This parameter is ignored the first time an application calls ShowWindow, if the program that launched the application provides a STARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the following values. |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool |
SystemParametersInfo(SystemParametersInfoActions, UInt32, ref AnimationInfo, SystemParametersInfoBehaviors)
See SystemParametersInfo function For setting AnimationInfo
Declaration
public static bool SystemParametersInfo(SystemParametersInfoActions uiAction, uint uiParam, ref AnimationInfo animationInfo, SystemParametersInfoBehaviors fWinIni)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemParametersInfoActions | uiAction | SystemParametersInfoActions |
| System.UInt32 | uiParam | A parameter whose usage and format depends on the system parameter being queried or set. For more information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must specify zero for this parameter. |
| AnimationInfo | animationInfo | AnimationInfo |
| SystemParametersInfoBehaviors | fWinIni | SystemParametersInfoBehaviors |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool |
SystemParametersInfo(SystemParametersInfoActions, UInt32, IntPtr, SystemParametersInfoBehaviors)
See SystemParametersInfo function For setting an IntPtr
Declaration
public static bool SystemParametersInfo(SystemParametersInfoActions uiAction, uint uiParam, IntPtr pvParam, SystemParametersInfoBehaviors fWinIni)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemParametersInfoActions | uiAction | SystemParametersInfoActions |
| System.UInt32 | uiParam | A parameter whose usage and format depends on the system parameter being queried or set. For more information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must specify zero for this parameter. |
| IntPtr | pvParam | IntPtr |
| SystemParametersInfoBehaviors | fWinIni | SystemParametersInfoBehaviors |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool |
SystemParametersInfo(SystemParametersInfoActions, UInt32, StringBuilder, SystemParametersInfoBehaviors)
See SystemParametersInfo function For reading a string parameter
Declaration
public static bool SystemParametersInfo(SystemParametersInfoActions uiAction, uint uiParam, StringBuilder pvParam, SystemParametersInfoBehaviors fWinIni)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemParametersInfoActions | uiAction | SystemParametersInfoActions |
| System.UInt32 | uiParam | A parameter whose usage and format depends on the system parameter being queried or set. For more information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must specify zero for this parameter. |
| StringBuilder | pvParam | string |
| SystemParametersInfoBehaviors | fWinIni | SystemParametersInfoBehaviors |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool |
SystemParametersInfo(SystemParametersInfoActions, UInt32, String, SystemParametersInfoBehaviors)
See SystemParametersInfo function For setting a string parameter
Declaration
public static bool SystemParametersInfo(SystemParametersInfoActions uiAction, uint uiParam, string pvParam, SystemParametersInfoBehaviors fWinIni)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemParametersInfoActions | uiAction | SystemParametersInfoActions |
| System.UInt32 | uiParam | A parameter whose usage and format depends on the system parameter being queried or set. For more information about system-wide parameters, see the uiAction parameter. If not otherwise indicated, you must specify zero for this parameter. |
| System.String | pvParam | string |
| SystemParametersInfoBehaviors | fWinIni | SystemParametersInfoBehaviors |
Returns
| Type | Description |
|---|---|
| System.Boolean | bool |