Class NativeMethods
Stores methods for working with windows.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Shared
Assembly: Syncfusion.Shared.Wpf.dll
Syntax
public class NativeMethods
Constructors
NativeMethods()
Declaration
public NativeMethods()
Fields
SM_CXSCREEN
SM_CXSCREEN value.
Declaration
public const int SM_CXSCREEN = 0
Field Value
Type |
---|
System.Int32 |
SM_CYSCREEN
SM_CYSCREEN value.
Declaration
public const int SM_CYSCREEN = 1
Field Value
Type |
---|
System.Int32 |
Methods
BitBlt(IntPtr, Int32, Int32, Int32, Int32, IntPtr, Int32, Int32, Int32)
Bits the BLT.
Declaration
public static bool BitBlt(IntPtr hdcDest, int xDest, int yDest, int wDest, int hDest, IntPtr hdcSource, int xSrc, int ySrc, int RasterOp)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hdcDest | The HDC dest. |
System.Int32 | xDest | The x dest. |
System.Int32 | yDest | The y dest. |
System.Int32 | wDest | The w dest. |
System.Int32 | hDest | The h dest. |
System.IntPtr | hdcSource | The HDC source. |
System.Int32 | xSrc | The x SRC. |
System.Int32 | ySrc | The y SRC. |
System.Int32 | RasterOp | The raster op. |
Returns
Type | Description |
---|---|
System.Boolean | bool value. |
ClipCursor(ref RECT)
Confines the cursor to a rectangular area on the screen.
Declaration
public static bool ClipCursor(ref RECT rcClip)
Parameters
Type | Name | Description |
---|---|---|
RECT | rcClip | Points to the RECT structure that contains the screen coordinates of the upper-left and lower-right corners of the confining rectangle. If this parameter is NULL, the cursor is free to move anywhere on the screen. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if successful, or false if an error occurred. |
ClipCursor(Object)
The ClipCursor function confines the cursor to a rectangular area on the screen.
Declaration
public static bool ClipCursor(object passNull)
Parameters
Type | Name | Description |
---|---|---|
System.Object | passNull | Pointer to the RECT structure that contains the screen coordinates of the upper-left and lower-right corners of the confining rectangle. If this parameter is NULL, the cursor is free to move anywhere on the screen. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if successful, or false if an error occurred. |
CreateCompatibleBitmap(IntPtr, Int32, Int32)
Creates the compatible bitmap.
Declaration
public static IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hdc | The HDC value. |
System.Int32 | nWidth | Width of the n. |
System.Int32 | nHeight | Height of the n. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr value. |
CreateCompatibleDC(IntPtr)
Creates the compatible DC.
Declaration
public static IntPtr CreateCompatibleDC(IntPtr hdc)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hdc | The HDC value. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr value. |
CreateDC(String, String, String, IntPtr)
Creates device context for a device using the specified name.
Declaration
public static IntPtr CreateDC(string lpszDriver, string lpszDevice, string lpszOutput, IntPtr lpInitData)
Parameters
Type | Name | Description |
---|---|---|
System.String | lpszDriver | |
System.String | lpszDevice | |
System.String | lpszOutput | |
System.IntPtr | lpInitData |
Returns
Type |
---|
System.IntPtr |
DeleteDC(IntPtr)
Deletes the DC.
Declaration
public static IntPtr DeleteDC(IntPtr hDc)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hDc | The handle dc. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr value. |
DeleteObject(IntPtr)
Deletes the object.
Declaration
public static IntPtr DeleteObject(IntPtr hDc)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hDc | The h delete object. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr value. |
DwmDefWindowProc(IntPtr, WM, IntPtr, IntPtr, out IntPtr)
DWMs the def window proc.
Declaration
public static bool DwmDefWindowProc(IntPtr hwnd, WM msg, IntPtr wParam, IntPtr lParam, out IntPtr plResult)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hwnd | The HWND Value. |
WM | msg | The MSG Value. |
System.IntPtr | wParam | The w param. |
System.IntPtr | lParam | The l param. |
System.IntPtr | plResult | The pl result. |
Returns
Type | Description |
---|---|
System.Boolean | Return bool value |
EnableMenuItem(IntPtr, SystemCommands, SystemMenuItemBehavior)
Enables the menu item.
Declaration
[CLSCompliant(false)]
public static SystemMenuItemBehavior EnableMenuItem(IntPtr hMenu, SystemCommands uIDEnableItem, SystemMenuItemBehavior uEnable)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hMenu | The h menu. |
SystemCommands | uIDEnableItem | The u ID enable item. |
SystemMenuItemBehavior | uEnable | The u enable. |
Returns
Type | Description |
---|---|
SystemMenuItemBehavior | Return the menu item |
FindWindow(String, String)
Finds the window.
Declaration
public static IntPtr FindWindow(string lpClassName, string lpWindowName)
Parameters
Type | Name | Description |
---|---|---|
System.String | lpClassName | Name of the lp class. |
System.String | lpWindowName | Name of the lp window. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr message value. |
FindWindowEx(IntPtr, IntPtr, String, IntPtr)
Finds the window ex.
Declaration
public static IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, IntPtr windowTitle)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | parentHandle | The parent handle. |
System.IntPtr | childAfter | The child after. |
System.String | className | Name of the class. |
System.IntPtr | windowTitle | The window title. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr message. |
GetCursorPos(ref Point)
Gets the cursor pos.
Declaration
public static bool GetCursorPos(ref Point lpPoint)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Point | lpPoint | The lp point. |
Returns
Type | Description |
---|---|
System.Boolean | Bool value message. |
GetDC(IntPtr)
Gets the DC.
Declaration
public static IntPtr GetDC(IntPtr hWnd)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hWnd | The h WND. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr type value. |
GetDesktopWindow()
Gets the desktop window.
Declaration
public static IntPtr GetDesktopWindow()
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr value. |
GetDeviceCaps(IntPtr, Int32)
The GetDeviceCaps function retrieves device-specific information for the specified device.
Declaration
public static int GetDeviceCaps(IntPtr hdc, int nIndex)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hdc | |
System.Int32 | nIndex |
Returns
Type |
---|
System.Int32 |
GetFontData(IntPtr, UInt32, UInt32, Byte[], UInt32)
Allows access to the data within a font metrics table in any TrueType / OpenType font.
Declaration
[CLSCompliant(false)]
public static uint GetFontData(IntPtr hdc, uint dwTable, uint dwOffset, byte[] lpvBuffer, uint cbData)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hdc | |
System.UInt32 | dwTable | |
System.UInt32 | dwOffset | |
System.Byte[] | lpvBuffer | |
System.UInt32 | cbData |
Returns
Type |
---|
System.UInt32 |
GetPixel(IntPtr, Int32, Int32)
Gets the pixel.
Declaration
public static int GetPixel(IntPtr hdc, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hdc | The HDC value. |
System.Int32 | x | The x value. |
System.Int32 | y | The y value. |
Returns
Type | Description |
---|---|
System.Int32 | IntPtr type which returns from Pixel |
GetSystemMenu(IntPtr, Boolean)
This function is implemented as a macro to maintain compatibility with existing code. Use the menu handle returned by this macro to disable the Close button. There is no other use for the return value.
Declaration
public static IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hWnd | Handle to the window that will own a copy of the window menu. |
System.Boolean | bRevert | Boolean value of TRUE if GetSystemMenu is to reset the window menu to the default state and destroy the previous window menu, if any. If this parameter is FALSE, GetSystemMenu returns the handle to the copy of the window menu currently in use. The copy is initially identical to the window menu, but it can be modified. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr message value. |
GetSystemMetrics(Int32)
Gets the system metrics.
Declaration
public static int GetSystemMetrics(int abc)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | abc | The abc (int value). |
Returns
Type | Description |
---|---|
System.Int32 | int value as system metrics |
GetWindowDC(Int32)
Gets the window DC.
Declaration
public static IntPtr GetWindowDC(int ptr)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | ptr | The PTR value. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr value |
GetWindowLongPtr(IntPtr, GWL)
Gets the window long PTR.
Declaration
public static IntPtr GetWindowLongPtr(IntPtr hwnd, GWL nIndex)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hwnd | The HWND Value. |
GWL | nIndex | Index of the n. |
Returns
Type | Description |
---|---|
System.IntPtr | Return the Window position |
GetWindowPlacement(IntPtr)
Gets the window placement.
Declaration
public static WINDOWPLACEMENT GetWindowPlacement(IntPtr hwnd)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hwnd | The HWND Value. |
Returns
Type | Description |
---|---|
WINDOWPLACEMENT | Return the window placement |
GetWindowRect(IntPtr, out RECT)
Gets the window rect.
Declaration
public static bool GetWindowRect(IntPtr hWnd, out RECT lpRect)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hWnd | The h WND. |
RECT | lpRect | The lp rect. |
Returns
Type | Description |
---|---|
System.Boolean | Boolean value. |
IntPtrToInt32(IntPtr)
Converts given System.IntPtr value to System.Int32 value.
Declaration
public static int IntPtrToInt32(IntPtr intPtr)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | intPtr | Given System.IntPtr value. |
Returns
Type | Description |
---|---|
System.Int32 | Result of conversion. |
LoWord(Int32)
Assigns zero to all bits of given value except four lower bits.
Declaration
public static int LoWord(int n)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | n | Given integer value. |
Returns
Type | Description |
---|---|
System.Int32 | Converted value. |
LoWord(IntPtr)
Assigns zero to all bits of given value except four lower bits.
Declaration
public static int LoWord(IntPtr n)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | n | Given System.IntPtr value. |
Returns
Type | Description |
---|---|
System.Int32 | Converted value. |
MoveWindow(IntPtr, Int32, Int32, Int32, Int32, Boolean)
The MoveWindow function changes the position and dimensions of the specified window. For a top-level window, the position and dimensions are relative to the upper-left corner of the screen. For a child window, they are relative to the upper-left corner of the parent window's client area.
Declaration
[SecurityCritical]
public static bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hWnd | Handle to the window. |
System.Int32 | X | Specifies the new position of the left side of the window. |
System.Int32 | Y | Specifies the new position of the top of the window. |
System.Int32 | nWidth | Specifies the new width of the window. |
System.Int32 | nHeight | Specifies the new height of the window. |
System.Boolean | bRepaint | Specifies whether the window is to be repainted. If this parameter is TRUE, the window receives a message. If the parameter is FALSE, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of moving a child window. |
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/>. |
ReleaseDC(IntPtr, IntPtr)
Releases the DC.
Declaration
public static int ReleaseDC(IntPtr hwnd, IntPtr hdc)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hwnd | The Handle WND. |
System.IntPtr | hdc | The HDC message. |
Returns
Type | Description |
---|---|
System.Int32 | IntPtr type which returns from DC |
ScreenToClient(IntPtr, POINT)
The function converts the screen coordinates of a specified point on the screen to client-area coordinates.
Declaration
public static void ScreenToClient(IntPtr hWnd, POINT pt)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hWnd | Handle to the window whose client area will be used for the conversion. |
POINT | pt | POINT structure that specifies the screen coordinates to be converted. |
SelectObject(IntPtr, IntPtr)
Selects the object.
Declaration
public static IntPtr SelectObject(IntPtr hdc, IntPtr bmp)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hdc | The HDC value. |
System.IntPtr | bmp | The BMP brush value. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr value. |
SendMessage(IntPtr, Int32, Int32, IntPtr)
Sends the message.
Declaration
public static IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hWnd | The handle window. |
System.Int32 | msg | The Message. |
System.Int32 | wParam | The actual message param. |
System.IntPtr | lParam | name of the task with which the pset is associated. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr value. |
SendMessage(IntPtr, Int32, IntPtr, Int32)
Sends the message.
Declaration
public static IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, int lParam)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hWnd | The handle WND. |
System.Int32 | msg | The MSG value. |
System.IntPtr | wParam | The window param. |
System.Int32 | lParam | The last param. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr value. |
SendMessage(IntPtr, Int32, IntPtr, IntPtr)
Sends the message.
Declaration
public static IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hWnd | The handle WND. |
System.Int32 | msg | The MSG value. |
System.IntPtr | wParam | The w param. |
System.IntPtr | lParam | The l param. |
Returns
Type | Description |
---|---|
System.IntPtr | IntPtr value. |
SetWindowLong(HandleRef, Int32, IntPtr)
The SetWindowLong function changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory.
Declaration
[SecurityCritical]
public static IntPtr SetWindowLong(HandleRef hWnd, int nIndex, IntPtr dwNewLong)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.InteropServices.HandleRef | hWnd | Handle to the window and, indirectly, the class to which the window belongs. |
System.Int32 | nIndex | Specifies the zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. |
System.IntPtr | dwNewLong | Specifies the replacement value. |
Returns
Type | Description |
---|---|
System.IntPtr | If the function succeeds, the return value is the previous value of the specified 32-bit integer. If the function fails, the return value is zero. |
SetWindowLongPtr(IntPtr, GWL, IntPtr)
Sets the window long PTR.
Declaration
public static IntPtr SetWindowLongPtr(IntPtr hwnd, GWL nIndex, IntPtr dwNewLong)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hwnd | The HWND value. |
GWL | nIndex | Index of the n. |
System.IntPtr | dwNewLong | The dw new long. |
Returns
Type | Description |
---|---|
System.IntPtr | Return the Integer Pointer |
SetWindowPos(IntPtr, Int32, Int32, Int32, Int32, Int32, Int32)
Changes the size, position, and Z order of a window.
Declaration
[SecurityCritical]
public static int SetWindowPos(IntPtr hwnd, int hwndInsertAfter, int x, int y, int cx, int cy, int wFlags)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hwnd | Handle of window. |
System.Int32 | hwndInsertAfter | Either the handle of the window to position this window behind, or a flag stating where in the Z-order to put the window. |
System.Int32 | x | The x coordinate of where to put the upper-left corner of the window. |
System.Int32 | y | The y coordinate of where to put the upper-left corner of the window. |
System.Int32 | cx | The x coordinate of where to put the lower-right corner of the window. |
System.Int32 | cy | The y coordinate of where to put the lower-right corner of the window. |
System.Int32 | wFlags | Specifies the window sizing and positioning flags. |
Returns
Type | Description |
---|---|
System.Int32 | Returns 1 if successful, or 0 if an error occurred. |
SHAppBarMessage(Int32, ref NativeMethods.APPBARDATA)
Declaration
public static int SHAppBarMessage(int dwMessage, ref NativeMethods.APPBARDATA pData)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dwMessage | |
NativeMethods.APPBARDATA | pData |
Returns
Type |
---|
System.Int32 |
Shell_NotifyIcon(Int32, ref NativeMethods.NotifyIconData)
Shell_s the notify icon.
Declaration
public static bool Shell_NotifyIcon(int dwMessage, ref NativeMethods.NotifyIconData pnid)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dwMessage | The dw message. |
NativeMethods.NotifyIconData | pnid | The pnid value. |
Returns
Type | Description |
---|---|
System.Boolean | Boolean value. |
ShowWindow(HandleRef, Int32)
Sets the specified window�s show state.
Declaration
[SecurityCritical]
public static bool ShowWindow(HandleRef hWnd, int nCmdShow)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.InteropServices.HandleRef | hWnd | The handle of the window to change the show status of. |
System.Int32 | nCmdShow | 0 = Hide the window. 1 = Show the window and activate it. 2 = Show the window minimized. 3 = Maximize the window. 4 = Show the window in its most recent size and position but do not activate it. 5 = Show the window. 6 = Minimize the window. 7 = Show the window minimized but do not activate it. 8 = Show the window in its current state but do not activate it 9 = Restore the window (not maximized nor minimized). |
Returns
Type | Description |
---|---|
System.Boolean | If the window was previously visible, the return value is true. If the window was previously hidden, the return value is false. |
StretchBlt(IntPtr, Int32, Int32, Int32, Int32, IntPtr, Int32, Int32, Int32, Int32, NativeMethods.TernaryRasterOperations)
Stretches the BLT.
Declaration
public static bool StretchBlt(IntPtr hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, IntPtr hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, NativeMethods.TernaryRasterOperations dwRop)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hdcDest | The HDC dest. |
System.Int32 | nXOriginDest | The n X origin dest. |
System.Int32 | nYOriginDest | The n Y origin dest. |
System.Int32 | nWidthDest | The n width dest. |
System.Int32 | nHeightDest | The n height dest. |
System.IntPtr | hdcSrc | The HDC SRC. |
System.Int32 | nXOriginSrc | The n X origin SRC. |
System.Int32 | nYOriginSrc | The n Y origin SRC. |
System.Int32 | nWidthSrc | The n width SRC. |
System.Int32 | nHeightSrc | The n height SRC. |
NativeMethods.TernaryRasterOperations | dwRop | The dw raster operation. |
Returns
Type | Description |
---|---|
System.Boolean | Boolean message value. |
TrackPopupMenu(IntPtr, UInt32, Int32, Int32, Int32, IntPtr, IntPtr)
The TrackPopupMenu function displays a shortcut menu at the specified location and tracks the selection of items on the menu. The shortcut menu can appear anywhere on the screen.
Declaration
[CLSCompliant(false)]
public static int TrackPopupMenu(IntPtr hMenu, uint uFlags, int x, int y, int nReserved, IntPtr hWnd, IntPtr prcRect)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | hMenu | The h menu. |
System.UInt32 | uFlags | The u flags. |
System.Int32 | x | The x value. |
System.Int32 | y | The y value. |
System.Int32 | nReserved | The n reserved. |
System.IntPtr | hWnd | The handle WND. |
System.IntPtr | prcRect | The PRC rect. |
Returns
Type | Description |
---|---|
System.Int32 | int message value. |