Completed work on adding all WinUser.h functions

pull/60/head
David Hall 2019-02-27 16:32:18 -07:00
parent c43e435401
commit 515fc01852
20 changed files with 7369 additions and 211 deletions

View File

@ -350,7 +350,7 @@ namespace Vanara.PInvoke
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-defdlgprocw LRESULT LRESULT DefDlgProcW( HWND hDlg, UINT
// Msg, WPARAM wParam, LPARAM lParam );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[DllImport(Lib.User32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("winuser.h", MSDNShortId = "defdlgproc")]
public static extern IntPtr DefDlgProc(HWND hDlg, uint Msg, IntPtr wParam, IntPtr lParam);
@ -627,6 +627,58 @@ namespace Vanara.PInvoke
[PInvokeData("winuser.h", MSDNShortId = "dialogboxparam")]
public static extern IntPtr DialogBoxParam(HINSTANCE hInstance, string lpTemplateName, HWND hWndParent, DialogProc lpDialogFunc, [Optional] IntPtr dwInitParam);
/// <summary>
/// Retrieves the current selection from a combo box filled by using the DlgDirListComboBox function. The selection is interpreted as
/// a drive letter, a file, or a directory name.
/// </summary>
/// <param name="hwndDlg">
/// <para>Type: <c>HWND</c></para>
/// <para>A handle to the dialog box that contains the combo box.</para>
/// </param>
/// <param name="lpString">
/// <para>Type: <c>LPTSTR</c></para>
/// <para>A pointer to the buffer that receives the selected path.</para>
/// </param>
/// <param name="cchOut">
/// <para>Type: <c>int</c></para>
/// <para>The length, in characters, of the buffer pointed to by the lpString parameter.</para>
/// </param>
/// <param name="idComboBox">
/// <para>Type: <c>int</c></para>
/// <para>The integer identifier of the combo box control in the dialog box.</para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>If the current selection is a directory name, the return value is nonzero.</para>
/// <para>If the current selection is not a directory name, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>
/// If the current selection specifies a directory name or drive letter, the <c>DlgDirSelectComboBoxEx</c> function removes the
/// enclosing square brackets (and hyphens for drive letters) so the name or letter is ready to be inserted into a new path or file
/// name. If there is no selection, the contents of the buffer pointed to by lpString do not change.
/// </para>
/// <para>The <c>DlgDirSelectComboBoxEx</c> function does not allow more than one file name to be returned from a combo box.</para>
/// <para>If the string is as long or longer than the buffer, the buffer contains the truncated string with a terminating null character.</para>
/// <para><c>DlgDirSelectComboBoxEx</c> sends CB_GETCURSEL and CB_GETLBTEXT messages to the combo box.</para>
/// <para>You can use this function with all three types of combo boxes (CBS_SIMPLE, CBS_DROPDOWN, and CBS_DROPDOWNLIST).</para>
/// <para>
/// <c>Security Warning:</c> Improper use of this function can cause problems for your application. For instance, the nCount
/// parameter should be set properly for both ANSI and Unicode versions. Failure to do so could lead to a buffer overflow. You should
/// review Security Considerations: Microsoft Windows Controls before continuing.
/// </para>
/// <para>
/// <c>Windows 95 or later</c>: <c>DlgDirSelectComboBoxExW</c> is supported by the Microsoft Layer for Unicode (MSLU). To use this,
/// you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows Me/98/95 Systems.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-dlgdirselectcomboboxexa BOOL DlgDirSelectComboBoxExA( HWND
// hwndDlg, LPSTR lpString, int cchOut, int idComboBox );
[DllImport(Lib.User32, SetLastError = true, CharSet = CharSet.Auto)]
[PInvokeData("winuser.h", MSDNShortId = "")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool DlgDirSelectComboBoxEx(HWND hwndDlg, StringBuilder lpString, int cchOut, int idComboBox);
/// <summary>
/// <para>Destroys a modal dialog box, causing the system to end any processing for the dialog box.</para>
/// </summary>

View File

@ -2,6 +2,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using Vanara.InteropServices;
using static Vanara.PInvoke.Gdi32;
@ -152,6 +153,36 @@ namespace Vanara.PInvoke
DCX_VALIDATE = 0x00200000,
}
/// <summary>Flags for <see cref="GetGuiResources"/></summary>
[PInvokeData("winuser.h", MSDNShortId = "55fbb7e8-79b4-4011-b522-25ea5a928b86")]
[Flags]
public enum GR
{
/// <summary>Return the count of GDI objects.</summary>
GR_GDIOBJECTS = 0,
/// <summary>
/// Return the peak count of GDI objects.
/// <para>
/// Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This value is not supported until Windows 7 and
/// Windows Server 2008 R2.
/// </para>
/// </summary>
GR_GDIOBJECTS_PEAK = 2,
/// <summary>Return the count of USER objects.</summary>
GR_USEROBJECTS = 1,
/// <summary>
/// Return the peak count of USER objects.
/// <para>
/// Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This value is not supported until Windows 7 and
/// Windows Server 2008 R2.
/// </para>
/// </summary>
GR_USEROBJECTS_PEAK = 4,
}
/// <summary>Values to use a return codes when handling the WM_HCHITTEST message.</summary>
public enum HitTestValues : short
{
@ -1490,21 +1521,130 @@ namespace Vanara.PInvoke
public static extern int ChangeDisplaySettingsEx([Optional] string lpszDeviceName, in DEVMODE lpDevMode, [Optional] HWND hwnd, [Optional] ChangeDisplaySettingsFlags dwflags, in VIDEOPARAMETERS lParam);
/// <summary>
/// Creates a new image (icon, cursor, or bitmap) and copies the attributes of the specified image to the new one. If necessary, the function stretches the bits to fit the desired size of the new image.
/// Creates a new image (icon, cursor, or bitmap) and copies the attributes of the specified image to the new one. If necessary, the
/// function stretches the bits to fit the desired size of the new image.
/// </summary>
/// <param name="h"><para>Type: <c>HANDLE</c></para><para>A handle to the image to be copied.</para></param>
/// <param name="type"><para>Type: <c>UINT</c></para><para>The type of image to be copied. This parameter can be one of the following values.</para><list type="table"><listheader><term>Value</term><term>Meaning</term></listheader><item><term> IMAGE_BITMAP 0 </term><term>Copies a bitmap.</term></item><item><term> IMAGE_CURSOR 2 </term><term>Copies a cursor.</term></item><item><term> IMAGE_ICON 1 </term><term>Copies an icon.</term></item></list></param>
/// <param name="cx"><para>Type: <c>int</c></para><para>The desired width, in pixels, of the image. If this is zero, then the returned image will have the same width as the original hImage.</para></param>
/// <param name="cy"><para>Type: <c>int</c></para><para>The desired height, in pixels, of the image. If this is zero, then the returned image will have the same height as the original hImage.</para></param>
/// <param name="flags"><para>Type: <c>UINT</c></para><para>This parameter can be one or more of the following values.</para><list type="table"><listheader><term>Value</term><term>Meaning</term></listheader><item><term> LR_COPYDELETEORG 0x00000008 </term><term>Deletes the original image after creating the copy.</term></item><item><term> LR_COPYFROMRESOURCE 0x00004000 </term><term> Tries to reload an icon or cursor resource from the original resource file rather than simply copying the current image. This is useful for creating a different-sized copy when the resource file contains multiple sizes of the resource. Without this flag, CopyImage stretches the original image to the new size. If this flag is set, CopyImage uses the size in the resource file closest to the desired size. This will succeed only if hImage was loaded by LoadIcon or LoadCursor, or by LoadImage with the LR_SHARED flag. </term></item><item><term> LR_COPYRETURNORG 0x00000004 </term><term> Returns the original hImage if it satisfies the criteria for the copy—that is, correct dimensions and color depth—in which case the LR_COPYDELETEORG flag is ignored. If this flag is not specified, a new object is always created. </term></item><item><term> LR_CREATEDIBSECTION 0x00002000 </term><term> If this is set and a new bitmap is created, the bitmap is created as a DIB section. Otherwise, the bitmap image is created as a device-dependent bitmap. This flag is only valid if uType is IMAGE_BITMAP. </term></item><item><term> LR_DEFAULTSIZE 0x00000040 </term><term> Uses the width or height specified by the system metric values for cursors or icons, if the cxDesired or cyDesired values are set to zero. If this flag is not specified and cxDesired and cyDesired are set to zero, the function uses the actual resource size. If the resource contains multiple images, the function uses the size of the first image. </term></item><item><term> LR_MONOCHROME 0x00000001 </term><term>Creates a new monochrome image.</term></item></list></param>
/// <param name="h">
/// <para>Type: <c>HANDLE</c></para>
/// <para>A handle to the image to be copied.</para>
/// </param>
/// <param name="type">
/// <para>Type: <c>UINT</c></para>
/// <para>The type of image to be copied. This parameter can be one of the following values.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>IMAGE_BITMAP 0</term>
/// <term>Copies a bitmap.</term>
/// </item>
/// <item>
/// <term>IMAGE_CURSOR 2</term>
/// <term>Copies a cursor.</term>
/// </item>
/// <item>
/// <term>IMAGE_ICON 1</term>
/// <term>Copies an icon.</term>
/// </item>
/// </list>
/// </param>
/// <param name="cx">
/// <para>Type: <c>int</c></para>
/// <para>
/// The desired width, in pixels, of the image. If this is zero, then the returned image will have the same width as the original hImage.
/// </para>
/// </param>
/// <param name="cy">
/// <para>Type: <c>int</c></para>
/// <para>
/// The desired height, in pixels, of the image. If this is zero, then the returned image will have the same height as the original hImage.
/// </para>
/// </param>
/// <param name="flags">
/// <para>Type: <c>UINT</c></para>
/// <para>This parameter can be one or more of the following values.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>LR_COPYDELETEORG 0x00000008</term>
/// <term>Deletes the original image after creating the copy.</term>
/// </item>
/// <item>
/// <term>LR_COPYFROMRESOURCE 0x00004000</term>
/// <term>
/// Tries to reload an icon or cursor resource from the original resource file rather than simply copying the current image. This is
/// useful for creating a different-sized copy when the resource file contains multiple sizes of the resource. Without this flag,
/// CopyImage stretches the original image to the new size. If this flag is set, CopyImage uses the size in the resource file closest
/// to the desired size. This will succeed only if hImage was loaded by LoadIcon or LoadCursor, or by LoadImage with the LR_SHARED flag.
/// </term>
/// </item>
/// <item>
/// <term>LR_COPYRETURNORG 0x00000004</term>
/// <term>
/// Returns the original hImage if it satisfies the criteria for the copy—that is, correct dimensions and color depth—in which case
/// the LR_COPYDELETEORG flag is ignored. If this flag is not specified, a new object is always created.
/// </term>
/// </item>
/// <item>
/// <term>LR_CREATEDIBSECTION 0x00002000</term>
/// <term>
/// If this is set and a new bitmap is created, the bitmap is created as a DIB section. Otherwise, the bitmap image is created as a
/// device-dependent bitmap. This flag is only valid if uType is IMAGE_BITMAP.
/// </term>
/// </item>
/// <item>
/// <term>LR_DEFAULTSIZE 0x00000040</term>
/// <term>
/// Uses the width or height specified by the system metric values for cursors or icons, if the cxDesired or cyDesired values are set
/// to zero. If this flag is not specified and cxDesired and cyDesired are set to zero, the function uses the actual resource size.
/// If the resource contains multiple images, the function uses the size of the first image.
/// </term>
/// </item>
/// <item>
/// <term>LR_MONOCHROME 0x00000001</term>
/// <term>Creates a new monochrome image.</term>
/// </item>
/// </list>
/// </param>
/// <returns>
/// <para>Type: <c>HANDLE</c></para><para>If the function succeeds, the return value is the handle to the newly created image.</para><para>If the function fails, the return value is <c>NULL</c>. To get extended error information, call GetLastError.</para>
/// <para>Type: <c>HANDLE</c></para>
/// <para>If the function succeeds, the return value is the handle to the newly created image.</para>
/// <para>If the function fails, the return value is <c>NULL</c>. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>When you are finished using the resource, you can release its associated memory by calling one of the functions in the following table.</para><list type="table"><listheader><term>Resource</term><term>Release function</term></listheader><item><term>Bitmap</term><term>DeleteObject</term></item><item><term>Cursor</term><term>DestroyCursor</term></item><item><term>Icon</term><term>DestroyIcon</term></item></list><para>The system automatically deletes the resource when its process terminates, however, calling the appropriate function saves memory and decreases the size of the process's working set.</para>
/// <para>
/// When you are finished using the resource, you can release its associated memory by calling one of the functions in the following table.
/// </para>
/// <list type="table">
/// <listheader>
/// <term>Resource</term>
/// <term>Release function</term>
/// </listheader>
/// <item>
/// <term>Bitmap</term>
/// <term>DeleteObject</term>
/// </item>
/// <item>
/// <term>Cursor</term>
/// <term>DestroyCursor</term>
/// </item>
/// <item>
/// <term>Icon</term>
/// <term>DestroyIcon</term>
/// </item>
/// </list>
/// <para>
/// The system automatically deletes the resource when its process terminates, however, calling the appropriate function saves memory
/// and decreases the size of the process's working set.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-copyimage
// HANDLE CopyImage( HANDLE h, UINT type, int cx, int cy, UINT flags );
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-copyimage HANDLE CopyImage( HANDLE h, UINT type, int cx,
// int cy, UINT flags );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h")]
public static extern HANDLE CopyImage(HANDLE h, LoadImageType type, int cx, int cy, CopyImageOptions flags);
@ -1533,7 +1673,403 @@ namespace Vanara.PInvoke
/// </returns>
[PInvokeData("WinUser.h", MSDNShortId = "dd162498")]
[DllImport(Lib.User32, CharSet = CharSet.Auto, SetLastError = true)]
public static extern int DrawText(HDC hDC, string lpchText, int nCount, ref RECT lpRect, DrawTextFlags uFormat);
public static extern int DrawText(HDC hDC, string lpchText, int nCount, in RECT lpRect, DrawTextFlags uFormat);
/// <summary>
/// The DrawText function draws formatted text in the specified rectangle. It formats the text according to the specified method
/// (expanding tabs, justifying characters, breaking lines, and so forth).
/// </summary>
/// <param name="hDC">A handle to the device context.</param>
/// <param name="lpchText">
/// A pointer to the string that specifies the text to be drawn. If the nCount parameter is -1, the string must be null-terminated.
/// If uFormat includes DT_MODIFYSTRING, the function could add up to four additional characters to this string. The buffer
/// containing the string should be large enough to accommodate these extra characters.
/// </param>
/// <param name="nCount">
/// The length, in characters, of the string. If nCount is -1, then the lpchText parameter is assumed to be a pointer to a
/// null-terminated string and DrawText computes the character count automatically.
/// </param>
/// <param name="lpRect">
/// A pointer to a RECT structure that contains the rectangle (in logical coordinates) in which the text is to be formatted.
/// </param>
/// <param name="uFormat">The method of formatting the text.</param>
/// <returns>
/// If the function succeeds, the return value is the height of the text in logical units. If DT_VCENTER or DT_BOTTOM is specified,
/// the return value is the offset from lpRect-&gt;top to the bottom of the drawn text. If the function fails, the return value is zero.
/// </returns>
[PInvokeData("WinUser.h", MSDNShortId = "dd162498")]
[DllImport(Lib.User32, CharSet = CharSet.Auto, SetLastError = true)]
public static extern int DrawText(HDC hDC, StringBuilder lpchText, int nCount, in RECT lpRect, DrawTextFlags uFormat);
/// <summary>The <c>DrawTextEx</c> function draws formatted text in the specified rectangle.</summary>
/// <param name="hdc">A handle to the device context in which to draw.</param>
/// <param name="lpchText">
/// <para>A pointer to the string that contains the text to draw. If the cchText parameter is -1, the string must be null-terminated.</para>
/// <para>
/// If dwDTFormat includes DT_MODIFYSTRING, the function could add up to four additional characters to this string. The buffer
/// containing the string should be large enough to accommodate these extra characters.
/// </para>
/// </param>
/// <param name="cchText">
/// The length of the string pointed to by lpchText. If cchText is -1, then the lpchText parameter is assumed to be a pointer to a
/// null-terminated string and <c>DrawTextEx</c> computes the character count automatically.
/// </param>
/// <param name="lprc">
/// A pointer to a RECT structure that contains the rectangle, in logical coordinates, in which the text is to be formatted.
/// </param>
/// <param name="format">
/// <para>The formatting options. This parameter can be one or more of the following values.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>DT_BOTTOM</term>
/// <term>Justifies the text to the bottom of the rectangle. This value is used only with the DT_SINGLELINE value.</term>
/// </item>
/// <item>
/// <term>DT_CALCRECT</term>
/// <term>
/// Determines the width and height of the rectangle. If there are multiple lines of text, DrawTextEx uses the width of the rectangle
/// pointed to by the lprc parameter and extends the base of the rectangle to bound the last line of text. If there is only one line
/// of text, DrawTextEx modifies the right side of the rectangle so that it bounds the last character in the line. In either case,
/// DrawTextEx returns the height of the formatted text, but does not draw the text.
/// </term>
/// </item>
/// <item>
/// <term>DT_CENTER</term>
/// <term>Centers text horizontally in the rectangle.</term>
/// </item>
/// <item>
/// <term>DT_EDITCONTROL</term>
/// <term>
/// Duplicates the text-displaying characteristics of a multiline edit control. Specifically, the average character width is
/// calculated in the same manner as for an edit control, and the function does not display a partially visible last line.
/// </term>
/// </item>
/// <item>
/// <term>DT_END_ELLIPSIS</term>
/// <term>
/// For displayed text, replaces the end of a string with ellipses so that the result fits in the specified rectangle. Any word (not
/// at the end of the string) that goes beyond the limits of the rectangle is truncated without ellipses. The string is not modified
/// unless the DT_MODIFYSTRING flag is specified. Compare with DT_PATH_ELLIPSIS and DT_WORD_ELLIPSIS.
/// </term>
/// </item>
/// <item>
/// <term>DT_EXPANDTABS</term>
/// <term>Expands tab characters. The default number of characters per tab is eight.</term>
/// </item>
/// <item>
/// <term>DT_EXTERNALLEADING</term>
/// <term>
/// Includes the font external leading in line height. Normally, external leading is not included in the height of a line of text.
/// </term>
/// </item>
/// <item>
/// <term>DT_HIDEPREFIX</term>
/// <term>
/// Ignores the ampersand (&amp;) prefix character in the text. The letter that follows will not be underlined, but other
/// mnemonic-prefix characters are still processed. Example: input string: "A&amp;bc&amp;&amp;d" normal: "Ac&amp;d" DT_HIDEPREFIX:
/// "Abc&amp;d" Compare with DT_NOPREFIX and DT_PREFIXONLY.
/// </term>
/// </item>
/// <item>
/// <term>DT_INTERNAL</term>
/// <term>Uses the system font to calculate text metrics.</term>
/// </item>
/// <item>
/// <term>DT_LEFT</term>
/// <term>Aligns text to the left.</term>
/// </item>
/// <item>
/// <term>DT_MODIFYSTRING</term>
/// <term>
/// Modifies the specified string to match the displayed text. This value has no effect unless DT_END_ELLIPSIS or DT_PATH_ELLIPSIS is specified.
/// </term>
/// </item>
/// <item>
/// <term>DT_NOCLIP</term>
/// <term>Draws without clipping. DrawTextEx is somewhat faster when DT_NOCLIP is used.</term>
/// </item>
/// <item>
/// <term>DT_NOFULLWIDTHCHARBREAK</term>
/// <term>
/// Prevents a line break at a DBCS (double-wide character string), so that the line-breaking rule is equivalent to SBCS strings. For
/// example, this can be used in Korean windows, for more readability of icon labels. This value has no effect unless DT_WORDBREAK is specified.
/// </term>
/// </item>
/// <item>
/// <term>DT_NOPREFIX</term>
/// <term>
/// Turns off processing of prefix characters. Normally, DrawTextEx interprets the ampersand (&amp;) mnemonic-prefix character as a
/// directive to underscore the character that follows, and the double-ampersand (&amp;&amp;) mnemonic-prefix characters as a
/// directive to print a single ampersand. By specifying DT_NOPREFIX, this processing is turned off. Compare with DT_HIDEPREFIX and DT_PREFIXONLY
/// </term>
/// </item>
/// <item>
/// <term>DT_PATH_ELLIPSIS</term>
/// <term>
/// For displayed text, replaces characters in the middle of the string with ellipses so that the result fits in the specified
/// rectangle. If the string contains backslash (\) characters, DT_PATH_ELLIPSIS preserves as much as possible of the text after the
/// last backslash. The string is not modified unless the DT_MODIFYSTRING flag is specified. Compare with DT_END_ELLIPSIS and DT_WORD_ELLIPSIS.
/// </term>
/// </item>
/// <item>
/// <term>DT_PREFIXONLY</term>
/// <term>
/// Draws only an underline at the position of the character following the ampersand (&amp;) prefix character. Does not draw any
/// character in the string. Example: input string: "A&amp;bc&amp;&amp;d" normal: "Ac&amp;d" PREFIXONLY: " _ " Compare with
/// DT_NOPREFIX and DT_HIDEPREFIX.
/// </term>
/// </item>
/// <item>
/// <term>DT_RIGHT</term>
/// <term>Aligns text to the right.</term>
/// </item>
/// <item>
/// <term>DT_RTLREADING</term>
/// <term>
/// Layout in right-to-left reading order for bidirectional text when the font selected into the hdc is a Hebrew or Arabic font. The
/// default reading order for all text is left-to-right.
/// </term>
/// </item>
/// <item>
/// <term>DT_SINGLELINE</term>
/// <term>Displays text on a single line only. Carriage returns and line feeds do not break the line.</term>
/// </item>
/// <item>
/// <term>DT_TABSTOP</term>
/// <term>
/// Sets tab stops. The DRAWTEXTPARAMS structure pointed to by the lpDTParams parameter specifies the number of average character
/// widths per tab stop.
/// </term>
/// </item>
/// <item>
/// <term>DT_TOP</term>
/// <term>Justifies the text to the top of the rectangle.</term>
/// </item>
/// <item>
/// <term>DT_VCENTER</term>
/// <term>Centers text vertically. This value is used only with the DT_SINGLELINE value.</term>
/// </item>
/// <item>
/// <term>DT_WORDBREAK</term>
/// <term>
/// Breaks words. Lines are automatically broken between words if a word extends past the edge of the rectangle specified by the lprc
/// parameter. A carriage return-line feed sequence also breaks the line.
/// </term>
/// </item>
/// <item>
/// <term>DT_WORD_ELLIPSIS</term>
/// <term>Truncates any word that does not fit in the rectangle and adds ellipses. Compare with DT_END_ELLIPSIS and DT_PATH_ELLIPSIS.</term>
/// </item>
/// </list>
/// </param>
/// <param name="lpdtp">
/// A pointer to a DRAWTEXTPARAMS structure that specifies additional formatting options. This parameter can be <c>NULL</c>.
/// </param>
/// <returns>
/// <para>
/// If the function succeeds, the return value is the text height in logical units. If DT_VCENTER or DT_BOTTOM is specified, the
/// return value is the offset from to the bottom of the drawn text
/// </para>
/// <para>If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>The <c>DrawTextEx</c> function supports only fonts whose escapement and orientation are both zero.</para>
/// <para>The text alignment mode for the device context must include the TA_LEFT, TA_TOP, and TA_NOUPDATECP flags.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-drawtextexa int DrawTextExA( HDC hdc, LPSTR lpchText, int
// cchText, LPRECT lprc, UINT format, LPDRAWTEXTPARAMS lpdtp );
[DllImport(Lib.User32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("winuser.h", MSDNShortId = "77b9973b-77f1-4508-a021-52d61d576c23")]
public static extern int DrawTextEx(HDC hdc, string lpchText, int cchText, in RECT lprc, DrawTextFlags format, [Optional] DRAWTEXTPARAMS lpdtp);
/// <summary>The <c>DrawTextEx</c> function draws formatted text in the specified rectangle.</summary>
/// <param name="hdc">A handle to the device context in which to draw.</param>
/// <param name="lpchText">
/// <para>A pointer to the string that contains the text to draw. If the cchText parameter is -1, the string must be null-terminated.</para>
/// <para>
/// If dwDTFormat includes DT_MODIFYSTRING, the function could add up to four additional characters to this string. The buffer
/// containing the string should be large enough to accommodate these extra characters.
/// </para>
/// </param>
/// <param name="cchText">
/// The length of the string pointed to by lpchText. If cchText is -1, then the lpchText parameter is assumed to be a pointer to a
/// null-terminated string and <c>DrawTextEx</c> computes the character count automatically.
/// </param>
/// <param name="lprc">
/// A pointer to a RECT structure that contains the rectangle, in logical coordinates, in which the text is to be formatted.
/// </param>
/// <param name="format">
/// <para>The formatting options. This parameter can be one or more of the following values.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>DT_BOTTOM</term>
/// <term>Justifies the text to the bottom of the rectangle. This value is used only with the DT_SINGLELINE value.</term>
/// </item>
/// <item>
/// <term>DT_CALCRECT</term>
/// <term>
/// Determines the width and height of the rectangle. If there are multiple lines of text, DrawTextEx uses the width of the rectangle
/// pointed to by the lprc parameter and extends the base of the rectangle to bound the last line of text. If there is only one line
/// of text, DrawTextEx modifies the right side of the rectangle so that it bounds the last character in the line. In either case,
/// DrawTextEx returns the height of the formatted text, but does not draw the text.
/// </term>
/// </item>
/// <item>
/// <term>DT_CENTER</term>
/// <term>Centers text horizontally in the rectangle.</term>
/// </item>
/// <item>
/// <term>DT_EDITCONTROL</term>
/// <term>
/// Duplicates the text-displaying characteristics of a multiline edit control. Specifically, the average character width is
/// calculated in the same manner as for an edit control, and the function does not display a partially visible last line.
/// </term>
/// </item>
/// <item>
/// <term>DT_END_ELLIPSIS</term>
/// <term>
/// For displayed text, replaces the end of a string with ellipses so that the result fits in the specified rectangle. Any word (not
/// at the end of the string) that goes beyond the limits of the rectangle is truncated without ellipses. The string is not modified
/// unless the DT_MODIFYSTRING flag is specified. Compare with DT_PATH_ELLIPSIS and DT_WORD_ELLIPSIS.
/// </term>
/// </item>
/// <item>
/// <term>DT_EXPANDTABS</term>
/// <term>Expands tab characters. The default number of characters per tab is eight.</term>
/// </item>
/// <item>
/// <term>DT_EXTERNALLEADING</term>
/// <term>
/// Includes the font external leading in line height. Normally, external leading is not included in the height of a line of text.
/// </term>
/// </item>
/// <item>
/// <term>DT_HIDEPREFIX</term>
/// <term>
/// Ignores the ampersand (&amp;) prefix character in the text. The letter that follows will not be underlined, but other
/// mnemonic-prefix characters are still processed. Example: input string: "A&amp;bc&amp;&amp;d" normal: "Ac&amp;d" DT_HIDEPREFIX:
/// "Abc&amp;d" Compare with DT_NOPREFIX and DT_PREFIXONLY.
/// </term>
/// </item>
/// <item>
/// <term>DT_INTERNAL</term>
/// <term>Uses the system font to calculate text metrics.</term>
/// </item>
/// <item>
/// <term>DT_LEFT</term>
/// <term>Aligns text to the left.</term>
/// </item>
/// <item>
/// <term>DT_MODIFYSTRING</term>
/// <term>
/// Modifies the specified string to match the displayed text. This value has no effect unless DT_END_ELLIPSIS or DT_PATH_ELLIPSIS is specified.
/// </term>
/// </item>
/// <item>
/// <term>DT_NOCLIP</term>
/// <term>Draws without clipping. DrawTextEx is somewhat faster when DT_NOCLIP is used.</term>
/// </item>
/// <item>
/// <term>DT_NOFULLWIDTHCHARBREAK</term>
/// <term>
/// Prevents a line break at a DBCS (double-wide character string), so that the line-breaking rule is equivalent to SBCS strings. For
/// example, this can be used in Korean windows, for more readability of icon labels. This value has no effect unless DT_WORDBREAK is specified.
/// </term>
/// </item>
/// <item>
/// <term>DT_NOPREFIX</term>
/// <term>
/// Turns off processing of prefix characters. Normally, DrawTextEx interprets the ampersand (&amp;) mnemonic-prefix character as a
/// directive to underscore the character that follows, and the double-ampersand (&amp;&amp;) mnemonic-prefix characters as a
/// directive to print a single ampersand. By specifying DT_NOPREFIX, this processing is turned off. Compare with DT_HIDEPREFIX and DT_PREFIXONLY
/// </term>
/// </item>
/// <item>
/// <term>DT_PATH_ELLIPSIS</term>
/// <term>
/// For displayed text, replaces characters in the middle of the string with ellipses so that the result fits in the specified
/// rectangle. If the string contains backslash (\) characters, DT_PATH_ELLIPSIS preserves as much as possible of the text after the
/// last backslash. The string is not modified unless the DT_MODIFYSTRING flag is specified. Compare with DT_END_ELLIPSIS and DT_WORD_ELLIPSIS.
/// </term>
/// </item>
/// <item>
/// <term>DT_PREFIXONLY</term>
/// <term>
/// Draws only an underline at the position of the character following the ampersand (&amp;) prefix character. Does not draw any
/// character in the string. Example: input string: "A&amp;bc&amp;&amp;d" normal: "Ac&amp;d" PREFIXONLY: " _ " Compare with
/// DT_NOPREFIX and DT_HIDEPREFIX.
/// </term>
/// </item>
/// <item>
/// <term>DT_RIGHT</term>
/// <term>Aligns text to the right.</term>
/// </item>
/// <item>
/// <term>DT_RTLREADING</term>
/// <term>
/// Layout in right-to-left reading order for bidirectional text when the font selected into the hdc is a Hebrew or Arabic font. The
/// default reading order for all text is left-to-right.
/// </term>
/// </item>
/// <item>
/// <term>DT_SINGLELINE</term>
/// <term>Displays text on a single line only. Carriage returns and line feeds do not break the line.</term>
/// </item>
/// <item>
/// <term>DT_TABSTOP</term>
/// <term>
/// Sets tab stops. The DRAWTEXTPARAMS structure pointed to by the lpDTParams parameter specifies the number of average character
/// widths per tab stop.
/// </term>
/// </item>
/// <item>
/// <term>DT_TOP</term>
/// <term>Justifies the text to the top of the rectangle.</term>
/// </item>
/// <item>
/// <term>DT_VCENTER</term>
/// <term>Centers text vertically. This value is used only with the DT_SINGLELINE value.</term>
/// </item>
/// <item>
/// <term>DT_WORDBREAK</term>
/// <term>
/// Breaks words. Lines are automatically broken between words if a word extends past the edge of the rectangle specified by the lprc
/// parameter. A carriage return-line feed sequence also breaks the line.
/// </term>
/// </item>
/// <item>
/// <term>DT_WORD_ELLIPSIS</term>
/// <term>Truncates any word that does not fit in the rectangle and adds ellipses. Compare with DT_END_ELLIPSIS and DT_PATH_ELLIPSIS.</term>
/// </item>
/// </list>
/// </param>
/// <param name="lpdtp">
/// A pointer to a DRAWTEXTPARAMS structure that specifies additional formatting options. This parameter can be <c>NULL</c>.
/// </param>
/// <returns>
/// <para>
/// If the function succeeds, the return value is the text height in logical units. If DT_VCENTER or DT_BOTTOM is specified, the
/// return value is the offset from to the bottom of the drawn text
/// </para>
/// <para>If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>The <c>DrawTextEx</c> function supports only fonts whose escapement and orientation are both zero.</para>
/// <para>The text alignment mode for the device context must include the TA_LEFT, TA_TOP, and TA_NOUPDATECP flags.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-drawtextexa int DrawTextExA( HDC hdc, LPSTR lpchText, int
// cchText, LPRECT lprc, UINT format, LPDRAWTEXTPARAMS lpdtp );
[DllImport(Lib.User32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("winuser.h", MSDNShortId = "77b9973b-77f1-4508-a021-52d61d576c23")]
public static extern int DrawTextEx(HDC hdc, StringBuilder lpchText, int cchText, in RECT lprc, DrawTextFlags format, [Optional] DRAWTEXTPARAMS lpdtp);
/// <summary>
/// The GetDC function retrieves a handle to a device context (DC) for the client area of a specified window or for the entire
@ -1651,6 +2187,58 @@ namespace Vanara.PInvoke
[PInvokeData("winuser.h", MSDNShortId = "590cf928-0ad6-43f8-97e9-1dafbcfa9f49")]
public static extern HDC GetDCEx(HWND hWnd, HRGN hrgnClip, DCX flags);
/// <summary>Retrieves the count of handles to graphical user interface (GUI) objects in use by the specified process.</summary>
/// <param name="hProcess">
/// A handle to the process. The handle must have the <c>PROCESS_QUERY_INFORMATION</c> access right. For more information, see
/// Process Security and Access Rights.
/// </param>
/// <param name="uiFlags">
/// <para>The GUI object type. This parameter can be one of the following values.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>GR_GDIOBJECTS 0</term>
/// <term>Return the count of GDI objects.</term>
/// </item>
/// <item>
/// <term>GR_GDIOBJECTS_PEAK 2</term>
/// <term>
/// Return the peak count of GDI objects. Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This value is not
/// supported until Windows 7 and Windows Server 2008 R2.
/// </term>
/// </item>
/// <item>
/// <term>GR_USEROBJECTS 1</term>
/// <term>Return the count of USER objects.</term>
/// </item>
/// <item>
/// <term>GR_USEROBJECTS_PEAK 4</term>
/// <term>
/// Return the peak count of USER objects. Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This value is not
/// supported until Windows 7 and Windows Server 2008 R2.
/// </term>
/// </item>
/// </list>
/// </param>
/// <returns>
/// <para>
/// If the function succeeds, the return value is the count of handles to GUI objects in use by the process. If no GUI objects are in
/// use, the return value is zero.
/// </para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// A process without a graphical user interface does not use GUI resources, therefore, <c>GetGuiResources</c> will return zero.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getguiresources DWORD GetGuiResources( HANDLE hProcess,
// DWORD uiFlags );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "55fbb7e8-79b4-4011-b522-25ea5a928b86")]
public static extern uint GetGuiResources(HPROCESS hProcess, GR uiFlags);
/// <summary>
/// Retrieves the current color of the specified display element. Display elements are the parts of a window and the display that
/// appear on the system display screen.
@ -1773,6 +2361,44 @@ namespace Vanara.PInvoke
return new Size(Macros.LOWORD(ret), Macros.HIWORD(ret));
}
/// <summary>The <c>GetUserObjectSecurity</c> function retrieves security information for the specified user object.</summary>
/// <param name="hObj">A handle to the user object for which to return security information.</param>
/// <param name="pSIRequested">A pointer to a SECURITY_INFORMATION value that specifies the security information being requested.</param>
/// <param name="pSID">
/// A pointer to a SECURITY_DESCRIPTOR structure in self-relative format that contains the requested information when the function
/// returns. This buffer must be aligned on a 4-byte boundary.
/// </param>
/// <param name="nLength">The length, in bytes, of the buffer pointed to by the pSD parameter.</param>
/// <param name="lpnLengthNeeded">
/// A pointer to a variable to receive the number of bytes required to store the complete security descriptor. If this variable's
/// value is greater than the value of the nLength parameter when the function returns, the function returns <c>FALSE</c> and none of
/// the security descriptor is copied to the buffer. Otherwise, the entire security descriptor is copied.
/// </param>
/// <returns>
/// <para>If the function succeeds, the function returns nonzero.</para>
/// <para>If the function fails, it returns zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>
/// To read the owner, group, or discretionary access control list (DACL) from the user object's security descriptor, the calling
/// process must have been granted READ_CONTROL access when the handle was opened.
/// </para>
/// <para>
/// To read the system access control list (SACL) from the security descriptor, the calling process must have been granted
/// ACCESS_SYSTEM_SECURITY access when the handle was opened. The correct way to get this access is to enable the SE_SECURITY_NAME
/// privilege in the caller's current token, open the handle for ACCESS_SYSTEM_SECURITY access, and then disable the privilege.
/// </para>
/// <para>Examples</para>
/// <para>For an example that uses this function, see Starting an Interactive Client Process.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getuserobjectsecurity BOOL GetUserObjectSecurity( HANDLE
// hObj, PSECURITY_INFORMATION pSIRequested, PSECURITY_DESCRIPTOR pSID, DWORD nLength, LPDWORD lpnLengthNeeded );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "998c2520-7833-4efd-a794-b13b528f0485")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetUserObjectSecurity(HANDLE hObj, in SECURITY_INFORMATION pSIRequested, PSECURITY_DESCRIPTOR pSID,
uint nLength, out uint lpnLengthNeeded);
/// <summary>
/// Retrieves information about the specified window. The function also retrieves the value at a specified offset into the extra
/// window memory.
@ -2205,6 +2831,71 @@ namespace Vanara.PInvoke
}
}
/// <summary>
/// The <c>SetUserObjectSecurity</c> function sets the security of a user object. This can be, for example, a window or a DDE conversation.
/// </summary>
/// <param name="hObj">A handle to a user object for which security information is set.</param>
/// <param name="pSIRequested">
/// <para>
/// A pointer to a value that indicates the components of the security descriptor to set. This parameter can be a combination of the
/// following values.
/// </para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>DACL_SECURITY_INFORMATION</term>
/// <term>
/// Sets the discretionary access control list (DACL) of the object. The handle specified by hObj must have WRITE_DAC access, or the
/// calling process must be the owner of the object.
/// </term>
/// </item>
/// <item>
/// <term>GROUP_SECURITY_INFORMATION</term>
/// <term>Sets the primary group security identifier (SID) of the object.</term>
/// </item>
/// <item>
/// <term>OWNER_SECURITY_INFORMATION</term>
/// <term>
/// Sets the SID of the owner of the object. The handle specified by hObj must have WRITE_OWNER access, or the calling process must
/// be the owner of the object or have the SE_TAKE_OWNERSHIP_NAME privilege enabled.
/// </term>
/// </item>
/// <item>
/// <term>SACL_SECURITY_INFORMATION</term>
/// <term>
/// Sets the system access control list (SACL) of the object. The handle specified by hObj must have ACCESS_SYSTEM_SECURITY access.
/// To obtain ACCESS_SYSTEM_SECURITY access
/// </term>
/// </item>
/// </list>
/// </param>
/// <param name="pSID">
/// <para>A pointer to a SECURITY_DESCRIPTOR structure that contains the new security information.</para>
/// <para>This buffer must be aligned on a 4-byte boundary.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the function returns nonzero.</para>
/// <para>If the function fails, it returns zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>
/// The <c>SetUserObjectSecurity</c> function applies changes specified in a security descriptor to the security descriptor assigned
/// to a user object. The security descriptor of the object must be in self-relative form. If necessary, this function allocates
/// additional memory to increase the size of the security descriptor.
/// </para>
/// <para>Examples</para>
/// <para>For an example that uses this function, see Starting an Interactive Client Process.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setuserobjectsecurity BOOL SetUserObjectSecurity( HANDLE
// hObj, PSECURITY_INFORMATION pSIRequested, PSECURITY_DESCRIPTOR pSID );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "219e41b8-9ac7-4747-a585-b6b9df6a1c9c")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetUserObjectSecurity(HANDLE hObj, in SECURITY_INFORMATION pSIRequested, PSECURITY_DESCRIPTOR pSID);
/// <summary>
/// Changes an attribute of the specified window. The function also sets a value at the specified offset in the extra window memory.
/// </summary>
@ -2258,6 +2949,40 @@ namespace Vanara.PInvoke
[SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist", Justification = "Entry point does exist on 64-bit Windows.")]
private static extern IntPtr SetWindowLongPtr64(HWND hWnd, WindowLongFlags nIndex, IntPtr dwNewLong);
/// <summary>
/// Grants or denies access to a handle to a User object to a job that has a user-interface restriction. When access is granted, all
/// processes associated with the job can subsequently recognize and use the handle. When access is denied, the processes can no
/// longer use the handle. For more information see User Objects.
/// </summary>
/// <param name="hUserHandle">A handle to the User object.</param>
/// <param name="hJob">
/// A handle to the job to be granted access to the User handle. The CreateJobObject or OpenJobObject function returns this handle.
/// </param>
/// <param name="bGrant">
/// If this parameter is TRUE, all processes associated with the job can recognize and use the handle. If the parameter is FALSE, the
/// processes cannot use the handle.
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>
/// The <c>UserHandleGrantAccess</c> function can be called only from a process not associated with the job specified by the hJob
/// parameter. The User handle must not be owned by a process or thread associated with the job.
/// </para>
/// <para>
/// To create user-interface restrictions, call the SetInformationJobObject function with the JobObjectBasicUIRestrictions job
/// information class.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-userhandlegrantaccess BOOL UserHandleGrantAccess( HANDLE
// hUserHandle, HANDLE hJob, BOOL bGrant );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "6e7a6cfc-f881-43cc-a5af-b97e0bf14bf4")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UserHandleGrantAccess(HANDLE hUserHandle, HANDLE hJob, [MarshalAs(UnmanagedType.Bool)] bool bGrant);
/// <summary>Contains information about a window's maximized size and position and its minimum and maximum tracking size.</summary>
[StructLayout(LayoutKind.Sequential)]
public struct MINMAXINFO
@ -2341,5 +3066,44 @@ namespace Vanara.PInvoke
/// <summary>Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.</summary>
public static HWND HWND_TOPMOST = new IntPtr(-1);
}
/// <summary>The <c>DRAWTEXTPARAMS</c> structure contains extended formatting options for the DrawTextEx function.</summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-tagdrawtextparams typedef struct tagDRAWTEXTPARAMS { UINT
// cbSize; int iTabLength; int iLeftMargin; int iRightMargin; UINT uiLengthDrawn; } DRAWTEXTPARAMS, *LPDRAWTEXTPARAMS;
[PInvokeData("winuser.h", MSDNShortId = "d3b89ce2-9a05-42af-b03e-24e1c4d6ef1d")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class DRAWTEXTPARAMS
{
/// <summary>Initializes a new instance of the <see cref="DRAWTEXTPARAMS"/> class.</summary>
/// <param name="tabLength">The size of each tab stop, in units equal to the average character width.</param>
/// <param name="leftMargin">The left margin, in units equal to the average character width.</param>
/// <param name="rightMargin">The right margin, in units equal to the average character width.</param>
public DRAWTEXTPARAMS(int tabLength = 0, int leftMargin = 0, int rightMargin = 0)
{
cbSize = (uint)Marshal.SizeOf(typeof(DRAWTEXTPARAMS));
iTabLength = tabLength;
iLeftMargin = leftMargin;
iRightMargin = rightMargin;
}
/// <summary>The structure size, in bytes.</summary>
public uint cbSize;
/// <summary>The size of each tab stop, in units equal to the average character width.</summary>
public int iTabLength;
/// <summary>The left margin, in units equal to the average character width.</summary>
public int iLeftMargin;
/// <summary>The right margin, in units equal to the average character width.</summary>
public int iRightMargin;
/// <summary>
/// Receives the number of characters processed by DrawTextEx, including white-space characters. The number can be the length of
/// the string or the index of the first line that falls below the drawing area. Note that <c>DrawTextEx</c> always processes the
/// entire string if the DT_NOCLIP formatting flag is specified.
/// </summary>
public uint uiLengthDrawn;
}
}
}

View File

@ -0,0 +1,433 @@
using System;
using System.Runtime.InteropServices;
using Vanara.InteropServices;
namespace Vanara.PInvoke
{
public static partial class User32_Gdi
{
/// <summary>Flags used by <see cref="WinHelp"/>.</summary>
[PInvokeData("winuser.h", MSDNShortId = "fce80bac-2a44-46e7-a87a-ef93f4599807")]
public enum HelpCmd : uint
{
/// <summary>Displays the topic identified by the specified context identifier defined in the [MAP] section of the .hpj file.</summary>
[CorrespondingType(typeof(int))]
HELP_CONTEXT = 0x0001,
/// <summary>
/// Informs Windows Help that it is no longer needed. If no other applications have asked for help, Windows closes Windows Help.
/// </summary>
HELP_QUIT = 0x0002,
/// <summary>
/// Displays the topic specified by the Contents option in the [OPTIONS] section of the .hpj file. This command is for backward
/// compatibility. New applications should use the HELP_FINDER command.
/// </summary>
HELP_INDEX = 0x0003,
/// <summary>
/// Displays the topic specified by the Contents option in the [OPTIONS] section of the .hpj file. This command is for backward
/// compatibility. New applications should provide a .cnt file and use the HELP_FINDER command.
/// </summary>
HELP_CONTENTS = 0x0003,
/// <summary>Displays help on how to use Windows Help, if the Winhlp32.hlp file is available.</summary>
HELP_HELPONHELP = 0x0004,
/// <summary>
/// Displays the index of the specified help file. An application should use this value only for help files with a single index.
/// It should not use this value with HELP_SETINDEX.
/// </summary>
[CorrespondingType(typeof(int))]
HELP_SETINDEX = 0x0005,
/// <summary>
/// Specifies the Contents topic. Windows Help displays this topic when the user clicks the Contents button if the Help file does
/// not have an associated .cnt file.
/// </summary>
[CorrespondingType(typeof(int))]
HELP_SETCONTENTS = 0x0005,
/// <summary>
/// Displays the topic identified by the specified context identifier defined in the [MAP] section of the .hpj file in a pop-up window.
/// </summary>
[CorrespondingType(typeof(int))]
HELP_CONTEXTPOPUP = 0x0008,
/// <summary>
/// Ensures that Windows Help is displaying the correct Help file. If the incorrect Help file is being displayed, Windows Help
/// opens the correct one; otherwise, there is no action.
/// </summary>
HELP_FORCEFILE = 0x0009,
/// <summary>
/// Displays the topic in the keyword table that matches the specified keyword, if there is an exact match. If there is more than
/// one match, displays the Index with the topics listed in the Topics Found list box.
/// </summary>
[CorrespondingType(typeof(string))]
HELP_KEY = 0x0101,
/// <summary>Executes a Help macro or macro string.</summary>
[CorrespondingType(typeof(string))]
HELP_COMMAND = 0x0102,
/// <summary>
/// Displays the topic in the keyword table that matches the specified keyword, if there is an exact match. If there is more than
/// one match, displays the Topics Found dialog box. To display the index without passing a keyword, use a pointer to an empty string.
/// </summary>
[CorrespondingType(typeof(string))]
HELP_PARTIALKEY = 0x0105,
/// <summary>Displays the topic specified by a keyword in an alternative keyword table.</summary>
[CorrespondingType(typeof(MULTIKEYHELP))]
HELP_MULTIKEY = 0x0201,
/// <summary>Displays the Windows Help window, if it is minimized or in memory, and sets its size and position as specified.</summary>
[CorrespondingType(typeof(HELPWININFO))]
HELP_SETWINPOS = 0x0203,
/// <summary>
/// Displays the Help menu for the selected window, then displays the topic for the selected control in a pop-up window.
/// </summary>
[CorrespondingType(typeof(byte[]))]
HELP_CONTEXTMENU = 0x000a,
/// <summary>Displays the Help Topics dialog box.</summary>
HELP_FINDER = 0x000b,
/// <summary>Displays the topic for the control identified by the hWndMain parameter in a pop-up window.</summary>
[CorrespondingType(typeof(byte[]))]
HELP_WM_HELP = 0x000c,
/// <summary>Sets the position of the subsequent pop-up window.</summary>
[CorrespondingType(typeof(int))]
HELP_SETPOPUP_POS = 0x000d,
/// <summary>
/// Indicates that a command is for a training card instance of Windows Help. Combine this command with other commands using the
/// bitwise OR operator.
/// </summary>
HELP_TCARD = 0x8000,
/// <summary>
/// The user clicked an authorable button. The dwActionData parameter contains a long integer specified by the Help author.
/// </summary>
HELP_TCARD_DATA = 0x0010,
/// <summary>Another application has requested training cards.</summary>
HELP_TCARD_OTHER_CALLER = 0x0011,
}
/// <summary>
/// Launches Windows Help (Winhelp.exe) and passes additional data that indicates the nature of the help requested by the application.
/// </summary>
/// <param name="hWndMain">
/// <para>Type: <c>HWND</c></para>
/// <para>
/// A handle to the window requesting help. The <c>WinHelp</c> function uses this handle to keep track of which applications have
/// requested help. If the uCommand parameter specifies <c>HELP_CONTEXTMENU</c> or <c>HELP_WM_HELP</c>, hWndMain identifies the
/// control requesting help.
/// </para>
/// </param>
/// <param name="lpszHelp">
/// <para>Type: <c>LPCTSTR</c></para>
/// <para>
/// The address of a null-terminated string containing the path, if necessary, and the name of the Help file that <c>WinHelp</c> is
/// to display.
/// </para>
/// <para>
/// The file name can be followed by an angle bracket (&gt;) and the name of a secondary window if the topic is to be displayed in a
/// secondary window rather than in the primary window. You must define the name of the secondary window in the [WINDOWS] section of
/// the Help project (.hpj) file.
/// </para>
/// </param>
/// <param name="uCommand">
/// <para>Type: <c>UINT</c></para>
/// <para>
/// The type of help requested. For a list of possible values and how they affect the value to place in the dwData parameter, see the
/// Remarks section.
/// </para>
/// </param>
/// <param name="dwData">
/// <para>Type: <c>ULONG_PTR</c></para>
/// <para>
/// Additional data. The value used depends on the value of the uCommand parameter. For a list of possible dwData values, see the
/// Remarks section.
/// </para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>Returns nonzero if successful, or zero otherwise. To retrieve extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>
/// Before closing the window that requested help, the application must call <c>WinHelp</c> with the uCommand parameter set to
/// HELP_QUIT. Until all applications have done this, Windows Help will not terminate. Note that calling Windows Help with the
/// HELP_QUIT command is not necessary if you used the HELP_CONTEXTPOPUP command to start Windows Help.
/// </para>
/// <para>This function fails if called from any context but the current user.</para>
/// <para>The following table shows the possible values for the uCommand parameter and the corresponding formats of the dwData parameter.</para>
/// <list type="table">
/// <listheader>
/// <term>uCommand</term>
/// <term>Action</term>
/// <term>dwData</term>
/// </listheader>
/// <item>
/// <term>HELP_COMMAND</term>
/// <term>Executes a Help macro or macro string.</term>
/// <term>
/// Address of a string that specifies the name of the Help macro(s) to run. If the string specifies multiple macro names, the names
/// must be separated by semicolons. You must use the short form of the macro name for some macros because Windows Help does not
/// support the long name.
/// </term>
/// </item>
/// <item>
/// <term>HELP_CONTENTS</term>
/// <term>
/// Displays the topic specified by the Contents option in the [OPTIONS] section of the .hpj file. This command is for backward
/// compatibility. New applications should provide a .cnt file and use the HELP_FINDER command.
/// </term>
/// <term>Ignored; set to 0.</term>
/// </item>
/// <item>
/// <term>HELP_CONTEXT</term>
/// <term>Displays the topic identified by the specified context identifier defined in the [MAP] section of the .hpj file.</term>
/// <term>Contains the context identifier for the topic.</term>
/// </item>
/// <item>
/// <term>HELP_CONTEXTMENU</term>
/// <term>Displays the Help menu for the selected window, then displays the topic for the selected control in a pop-up window.</term>
/// <term>
/// Address of an array of DWORD pairs. The first DWORD in each pair is the control identifier, and the second is the context
/// identifier for the topic. The array must be terminated by a pair of zeros {0,0}. If you do not want to add Help to a particular
/// control, set its context identifier to -1.
/// </term>
/// </item>
/// <item>
/// <term>HELP_CONTEXTPOPUP</term>
/// <term>
/// Displays the topic identified by the specified context identifier defined in the [MAP] section of the .hpj file in a pop-up window.
/// </term>
/// <term>Contains the context identifier for a topic.</term>
/// </item>
/// <item>
/// <term>HELP_FINDER</term>
/// <term>Displays the Help Topics dialog box.</term>
/// <term>Ignored; set to 0.</term>
/// </item>
/// <item>
/// <term>HELP_FORCEFILE</term>
/// <term>
/// Ensures that Windows Help is displaying the correct Help file. If the incorrect Help file is being displayed, Windows Help opens
/// the correct one; otherwise, there is no action.
/// </term>
/// <term>Ignored; set to 0.</term>
/// </item>
/// <item>
/// <term>HELP_HELPONHELP</term>
/// <term>Displays help on how to use Windows Help, if the Winhlp32.hlp file is available.</term>
/// <term>Ignored; set to 0.</term>
/// </item>
/// <item>
/// <term>HELP_INDEX</term>
/// <term>
/// Displays the topic specified by the Contents option in the [OPTIONS] section of the .hpj file. This command is for backward
/// compatibility. New applications should use the HELP_FINDER command.
/// </term>
/// <term>Ignored; set to 0.</term>
/// </item>
/// <item>
/// <term>HELP_KEY</term>
/// <term>
/// Displays the topic in the keyword table that matches the specified keyword, if there is an exact match. If there is more than one
/// match, displays the Index with the topics listed in the Topics Found list box.
/// </term>
/// <term>Address of a keyword string. Multiple keywords must be separated by semicolons.</term>
/// </item>
/// <item>
/// <term>HELP_MULTIKEY</term>
/// <term>Displays the topic specified by a keyword in an alternative keyword table.</term>
/// <term>Address of a MULTIKEYHELP structure that specifies a table footnote character and a keyword.</term>
/// </item>
/// <item>
/// <term>HELP_PARTIALKEY</term>
/// <term>
/// Displays the topic in the keyword table that matches the specified keyword, if there is an exact match. If there is more than one
/// match, displays the Topics Found dialog box. To display the index without passing a keyword, use a pointer to an empty string.
/// </term>
/// <term>Address of a keyword string. Multiple keywords must be separated by semicolons.</term>
/// </item>
/// <item>
/// <term>HELP_QUIT</term>
/// <term>
/// Informs Windows Help that it is no longer needed. If no other applications have asked for help, Windows closes Windows Help.
/// </term>
/// <term>Ignored; set to 0.</term>
/// </item>
/// <item>
/// <term>HELP_SETCONTENTS</term>
/// <term>
/// Specifies the Contents topic. Windows Help displays this topic when the user clicks the Contents button if the Help file does not
/// have an associated .cnt file.
/// </term>
/// <term>Contains the context identifier for the Contents topic.</term>
/// </item>
/// <item>
/// <term>HELP_SETPOPUP_POS</term>
/// <term>Sets the position of the subsequent pop-up window.</term>
/// <term>
/// Contains the position data. Use MAKELONG to concatenate the horizontal and vertical coordinates into a single value. The pop-up
/// window is positioned as if the mouse cursor were at the specified point when the pop-up window was invoked.
/// </term>
/// </item>
/// <item>
/// <term>HELP_SETWINPOS</term>
/// <term>Displays the Windows Help window, if it is minimized or in memory, and sets its size and position as specified.</term>
/// <term>Address of a HELPWININFO structure that specifies the size and position of either a primary or secondary Help window.</term>
/// </item>
/// <item>
/// <term>HELP_TCARD</term>
/// <term>
/// Indicates that a command is for a training card instance of Windows Help. Combine this command with other commands using the
/// bitwise OR operator.
/// </term>
/// <term>Depends on the command with which this command is combined.</term>
/// </item>
/// <item>
/// <term>HELP_WM_HELP</term>
/// <term>Displays the topic for the control identified by the hWndMain parameter in a pop-up window.</term>
/// <term>
/// Address of an array of DWORD pairs. The first DWORD in each pair is a control identifier, and the second is a context identifier
/// for a topic. The array must be terminated by a pair of zeros {0,0}. If you do not want to add Help to a particular control, set
/// its context identifier to -1.
/// </term>
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-winhelpa BOOL WinHelpA( HWND hWndMain, LPCSTR lpszHelp,
// UINT uCommand, ULONG_PTR dwData );
[DllImport(Lib.User32, SetLastError = true, CharSet = CharSet.Auto)]
[PInvokeData("winuser.h", MSDNShortId = "fce80bac-2a44-46e7-a87a-ef93f4599807")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool WinHelp(HWND hWndMain, string lpszHelp, HelpCmd uCommand, IntPtr dwData);
/// <summary>
/// Contains the size and position of either a primary or secondary Help window. An application can set this information by calling
/// the WinHelp function with the HELP_SETWINPOS value.
/// </summary>
/// <remarks>
/// <para>
/// Windows Help divides the display into 1024 units in both the X and Y directions. To create a secondary window that fills the
/// upper-left quadrant of the display, for example, an application would specify zero for the <c>x</c> and <c>y</c> members and 512
/// for the <c>dx</c> and <c>dy</c> members.
/// </para>
/// <para>
/// To calculate <c>wStructSize</c> properly, the actual size of the string to be stored at <c>rgchMember</c> must be known. Since
/// sizeof(HELPWININFO) includes two <c>TCHARs</c> by definition, they must be taken into account in the final total. The following
/// example shows the proper calculation of an instance of <c>wStructSize</c>.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-taghelpwininfoa typedef struct tagHELPWININFOA { int
// wStructSize; int x; int y; int dx; int dy; int wMax; CHAR rgchMember[2]; } HELPWININFOA, *PHELPWININFOA, *LPHELPWININFOA;
[PInvokeData("winuser.h", MSDNShortId = "0de0bf84-66f3-44bc-b4de-c2de7ca90cb2")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct HELPWININFO
{
/// <summary>
/// <para>Type: <c>int</c></para>
/// <para>The size of this structure, in bytes.</para>
/// </summary>
public int wStructSize;
/// <summary>
/// <para>Type: <c>int</c></para>
/// <para>X-coordinate of the upper-left corner of the window, in screen coordinates.</para>
/// </summary>
public int x;
/// <summary>
/// <para>Type: <c>int</c></para>
/// <para>Y-coordinate of the upper-left corner of the window, in screen coordinates.</para>
/// </summary>
public int y;
/// <summary>
/// <para>Type: <c>int</c></para>
/// <para>The width of the window, in pixels.</para>
/// </summary>
public int dx;
/// <summary>
/// <para>Type: <c>int</c></para>
/// <para>The height of the window, in pixels.</para>
/// </summary>
public int dy;
/// <summary>
/// <para>Type: <c>int</c></para>
/// <para>
/// Options for display of the window. Several values also determine the activation (focus) state of the window or other windows.
/// This member must be one of the following values.
/// </para>
/// <para>SW_HIDE</para>
/// <para>Hides the window and passes activation to another window.</para>
/// <para>SW_MINIMIZE</para>
/// <para>Minimizes the specified window and activates the top-level window in the z-order.</para>
/// <para>SW_RESTORE</para>
/// <para>Same as <c>SW_SHOWNORMAL</c>.</para>
/// <para>SW_SHOW</para>
/// <para>Activates a window and displays it in its current size and position.</para>
/// <para>SW_SHOWMAXIMIZED</para>
/// <para>Activates the window and displays it as a maximized window.</para>
/// <para>SW_SHOWMINIMIZED</para>
/// <para>Activates the window and displays it as an icon.</para>
/// <para>SW_SHOWMINNOACTIVE</para>
/// <para>Displays the window as an icon. The window that is currently active remains active.</para>
/// <para>SW_SHOWNA</para>
/// <para>Displays the window in its current state. The window that is currently active remains active.</para>
/// <para>SW_SHOWNOACTIVATE</para>
/// <para>Displays a window in its most recent size and position. The window that is currently active remains active.</para>
/// <para>SW_SHOWNORMAL</para>
/// <para>
/// Activates and displays the window. Whether the window is minimized or maximized, Windows restores it to its original size and position.
/// </para>
/// </summary>
public ShowWindowCommand wMax;
/// <summary>
/// <para>Type: <c>TCHAR[2]</c></para>
/// <para>The name of the window.</para>
/// </summary>
/// <value>The <see cref="System.Byte"/>.</value>
/// <returns></returns>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string rgchMember;
}
/// <summary>Specifies a keyword to search for and the keyword table to be searched by Windows Help.</summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-tagmultikeyhelpa typedef struct tagMULTIKEYHELPA { #if ...
// DWORD mkSize; #else WORD mkSize; #endif CHAR mkKeylist; CHAR szKeyphrase[1]; } MULTIKEYHELPA, *PMULTIKEYHELPA, *LPMULTIKEYHELPA;
[PInvokeData("winuser.h", MSDNShortId = "5fe0cd44-196c-4d9a-b9f8-2a97a92f2545")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct MULTIKEYHELP
{
/// <summary>The mk size</summary>
public uint mkSize;
/// <summary>
/// <para>Type: <c>TCHAR</c></para>
/// <para>A single character that identifies the keyword table to search.</para>
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)]
public string mkKeylist;
/// <summary>
/// <para>Type: <c>TCHAR[1]</c></para>
/// <para>A null-terminated text string that specifies the keyword to locate in the keyword table.</para>
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 253)]
public string szKeyphrase;
}
}
}

View File

@ -1149,6 +1149,21 @@ namespace Vanara.PInvoke
[PInvokeData("winuser.h", MSDNShortId = "getmenucheckmarkdimensions.htm")]
public static extern int GetMenuCheckMarkDimensions();
/// <summary>Retrieves the Help context identifier associated with the specified menu.</summary>
/// <param name="Arg1">
/// <para>Type: <c>HMENU</c></para>
/// <para>A handle to the menu for which the Help context identifier is to be retrieved.</para>
/// </param>
/// <returns>
/// <para>Type: <c>DWORD</c></para>
/// <para>Returns the Help context identifier if the menu has one, or zero otherwise.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getmenucontexthelpid DWORD GetMenuContextHelpId( HMENU
// Arg1 );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "2b8d3e94-6860-4a75-8373-38afb641eb3b")]
public static extern uint GetMenuContextHelpId(HMENU Arg1);
/// <summary>
/// <para>Determines the default menu item on the specified menu.</para>
/// </summary>
@ -2702,6 +2717,28 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetMenu(HWND hWnd, HMENU hMenu);
/// <summary>Associates a Help context identifier with a menu.</summary>
/// <param name="arg1">
/// <para>Type: <c>HMENU</c></para>
/// <para>A handle to the menu with which to associate the Help context identifier.</para>
/// </param>
/// <param name="arg2">
/// <para>Type: <c>DWORD</c></para>
/// <para>The help context identifier.</para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>Returns nonzero if successful, or zero otherwise.</para>
/// <para>To retrieve extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>All items in the menu share this identifier. Help context identifiers can't be attached to individual menu items.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setmenucontexthelpid
// BOOL SetMenuContextHelpId( HMENU , DWORD );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "55d944db-d889-468a-991a-b9779c90b44f")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetMenuContextHelpId(HMENU arg1, uint arg2);
/// <summary>
/// <para>Sets the default menu item for the specified menu.</para>
/// </summary>
@ -4049,7 +4086,9 @@ namespace Vanara.PInvoke
{
/// <summary>Initializes a new instance of the <see cref="SafeHMENU"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
/// <param name="ownsHandle"><see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).</param>
/// <param name="ownsHandle">
/// <see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).
/// </param>
public SafeHMENU(IntPtr preexistingHandle, bool ownsHandle = true) : base(preexistingHandle, ownsHandle) { }
/// <summary>Initializes a new instance of the <see cref="SafeHMENU"/> class.</summary>

View File

@ -143,6 +143,35 @@ namespace Vanara.PInvoke
ISMEX_SEND = 0x00000001,
}
/// <summary>Flags for <see cref="MsgWaitForMultipleObjectsEx"/></summary>
[PInvokeData("winuser.h", MSDNShortId = "1774b721-3ad4-492e-96af-b71de9066f0c")]
[Flags]
public enum MWMO
{
/// <summary>
/// The function returns when any one of the objects is signaled. The return value indicates the object whose state caused the
/// function to return.
/// </summary>
MWMO_ANY = 0,
/// <summary>
/// The function also returns if an APC has been queued to the thread with QueueUserAPC while the thread is in the waiting state.
/// </summary>
MWMO_ALERTABLE = 0x0002,
/// <summary>
/// The function returns if input exists for the queue, even if the input has been seen (but not removed) using a call to another
/// function, such as PeekMessage.
/// </summary>
MWMO_INPUTAVAILABLE = 0x0004,
/// <summary>
/// The function returns when all objects in the pHandles array are signaled and an input event has been received, all at the
/// same time.
/// </summary>
MWMO_WAITALL = 0x0001,
}
/// <summary>Flags used by PeekMessage.</summary>
[PInvokeData("winuser.h")]
[Flags]
@ -563,6 +592,33 @@ namespace Vanara.PInvoke
[PInvokeData("winuser.h")]
public static extern IntPtr DispatchMessage(in MSG lpMsg);
/// <summary>
/// Frees the memory specified by the lParam parameter of a posted Dynamic Data Exchange (DDE) message. An application receiving a
/// posted DDE message should call this function after it has used the UnpackDDElParam function to unpack the lParam value.
/// </summary>
/// <param name="msg">
/// <para>Type: <c>UINT</c></para>
/// <para>The posted DDE message.</para>
/// </param>
/// <param name="lParam">
/// <para>Type: <c>LPARAM</c></para>
/// <para>The lParam parameter of the posted DDE message.</para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>An application should call this function only for posted DDE messages.</para>
/// <para>This function frees the memory specified by the lParam parameter. It does not free the contents of lParam.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/dde/nf-dde-freeddelparam BOOL FreeDDElParam( UINT msg, LPARAM lParam );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("dde.h", MSDNShortId = "")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FreeDDElParam(uint msg, IntPtr lParam);
/// <summary>Determines whether there are mouse-button or keyboard messages in the calling thread's message queue.</summary>
/// <returns>
/// <para>Type: <c>Type: <c>BOOL</c></c></para>
@ -928,6 +984,562 @@ namespace Vanara.PInvoke
[PInvokeData("winuser.h")]
public static extern ISMEX InSendMessageEx([Optional] IntPtr lpReserved);
/// <summary>Determines whether the last message read from the current thread's queue originated from a WOW64 process.</summary>
/// <returns>
/// The function returns TRUE if the last message read from the current thread's queue originated from a WOW64 process, and FALSE otherwise.
/// </returns>
/// <remarks>
/// <para>
/// This function is useful to helping you develop 64-bit native applications that can receive private messages sent from 32-bit
/// client applications, if the messages are associated with data structures that contain pointer-dependent data. In these
/// situations, you can call this function in your 64-bit native application to determine if the message originated from a WOW64
/// process and then thunk the message appropriately.
/// </para>
/// <para>Examples</para>
/// <para>
/// For compatibility with operating systems that do not support this function, call GetProcAddress to detect whether
/// <c>IsWow64Message</c> is implemented in User32.dll. If <c>GetProcAddress</c> succeeds, it is safe to call this function.
/// Otherwise, WOW64 is not present. Note that this technique is not a reliable way to detect whether the operating system is a
/// 64-bit version of Windows because the User32.dll in current versions of 32-bit Windows also contains this function.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-iswow64message BOOL IsWow64Message( );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "bc0ac424-3c5b-41bf-9dae-bcb405d5b548")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsWow64Message();
/// <summary>
/// <para>
/// Waits until one or all of the specified objects are in the signaled state or the time-out interval elapses. The objects can
/// include input event objects, which you specify using the dwWakeMask parameter.
/// </para>
/// <para>To enter an alertable wait state, use the MsgWaitForMultipleObjectsEx function.</para>
/// </summary>
/// <param name="nCount">
/// The number of object handles in the array pointed to by pHandles. The maximum number of object handles is
/// <c>MAXIMUM_WAIT_OBJECTS</c> minus one. If this parameter has the value zero, then the function waits only for an input event.
/// </param>
/// <param name="pHandles">
/// <para>
/// An array of object handles. For a list of the object types whose handles can be specified, see the following Remarks section. The
/// array can contain handles of objects of different types. It may not contain multiple copies of the same handle.
/// </para>
/// <para>If one of these handles is closed while the wait is still pending, the function's behavior is undefined.</para>
/// <para>The handles must have the <c>SYNCHRONIZE</c> access right. For more information, see Standard Access Rights.</para>
/// </param>
/// <param name="fWaitAll">
/// If this parameter is <c>TRUE</c>, the function returns when the states of all objects in the pHandles array have been set to
/// signaled and an input event has been received. If this parameter is <c>FALSE</c>, the function returns when the state of any one
/// of the objects is set to signaled or an input event has been received. In this case, the return value indicates the object whose
/// state caused the function to return.
/// </param>
/// <param name="dwMilliseconds">
/// The time-out interval, in milliseconds. If a nonzero value is specified, the function waits until the specified objects are
/// signaled or the interval elapses. If dwMilliseconds is zero, the function does not enter a wait state if the specified objects
/// are not signaled; it always returns immediately. If dwMilliseconds is <c>INFINITE</c>, the function will return only when the
/// specified objects are signaled.
/// </param>
/// <param name="dwWakeMask">
/// <para>
/// The input types for which an input event object handle will be added to the array of object handles. This parameter can be any
/// combination of the following values.
/// </para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>QS_ALLEVENTS 0x04BF</term>
/// <term>
/// An input, WM_TIMER, WM_PAINT, WM_HOTKEY, or posted message is in the queue. This value is a combination of QS_INPUT,
/// QS_POSTMESSAGE, QS_TIMER, QS_PAINT, and QS_HOTKEY.
/// </term>
/// </item>
/// <item>
/// <term>QS_ALLINPUT 0x04FF</term>
/// <term>
/// Any message is in the queue. This value is a combination of QS_INPUT, QS_POSTMESSAGE, QS_TIMER, QS_PAINT, QS_HOTKEY, and QS_SENDMESSAGE.
/// </term>
/// </item>
/// <item>
/// <term>QS_ALLPOSTMESSAGE 0x0100</term>
/// <term>A posted message is in the queue. This value is cleared when you call GetMessage or PeekMessage without filtering messages.</term>
/// </item>
/// <item>
/// <term>QS_HOTKEY 0x0080</term>
/// <term>A WM_HOTKEY message is in the queue.</term>
/// </item>
/// <item>
/// <term>QS_INPUT 0x407</term>
/// <term>An input message is in the queue. This value is a combination of QS_MOUSE, QS_KEY, and QS_RAWINPUT.</term>
/// </item>
/// <item>
/// <term>QS_KEY 0x0001</term>
/// <term>A WM_KEYUP, WM_KEYDOWN, WM_SYSKEYUP, or WM_SYSKEYDOWN message is in the queue.</term>
/// </item>
/// <item>
/// <term>QS_MOUSE 0x0006</term>
/// <term>
/// A WM_MOUSEMOVE message or mouse-button message (WM_LBUTTONUP, WM_RBUTTONDOWN, and so on). This value is a combination of
/// QS_MOUSEMOVE and QS_MOUSEBUTTON.
/// </term>
/// </item>
/// <item>
/// <term>QS_MOUSEBUTTON 0x0004</term>
/// <term>A mouse-button message (WM_LBUTTONUP, WM_RBUTTONDOWN, and so on).</term>
/// </item>
/// <item>
/// <term>QS_MOUSEMOVE 0x0002</term>
/// <term>A WM_MOUSEMOVE message is in the queue.</term>
/// </item>
/// <item>
/// <term>QS_PAINT 0x0020</term>
/// <term>A WM_PAINT message is in the queue.</term>
/// </item>
/// <item>
/// <term>QS_POSTMESSAGE 0x0008</term>
/// <term>
/// A posted message is in the queue. This value is cleared when you call GetMessage or PeekMessage, whether or not you are filtering messages.
/// </term>
/// </item>
/// <item>
/// <term>QS_RAWINPUT 0x0400</term>
/// <term>A raw input message is in the queue. For more information, see Raw Input.</term>
/// </item>
/// <item>
/// <term>QS_SENDMESSAGE 0x0040</term>
/// <term>A message sent by another thread or application is in the queue.</term>
/// </item>
/// <item>
/// <term>QS_TIMER 0x0010</term>
/// <term>A WM_TIMER message is in the queue.</term>
/// </item>
/// </list>
/// </param>
/// <returns>
/// <para>
/// If the function succeeds, the return value indicates the event that caused the function to return. It can be one of the following
/// values. (Note that <c>WAIT_OBJECT_0</c> is defined as 0 and <c>WAIT_ABANDONED_0</c> is defined as 0x00000080L.)
/// </para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term>WAIT_OBJECT_0 to (WAIT_OBJECT_0 + nCount 1)</term>
/// <term>
/// If bWaitAll is TRUE, the return value indicates that the state of all specified objects is signaled. If bWaitAll is FALSE, the
/// return value minus WAIT_OBJECT_0 indicates the pHandles array index of the object that satisfied the wait.
/// </term>
/// </item>
/// <item>
/// <term>WAIT_OBJECT_0 + nCount</term>
/// <term>
/// New input of the type specified in the dwWakeMask parameter is available in the thread's input queue. Functions such as
/// PeekMessage, GetMessage, and WaitMessage mark messages in the queue as old messages. Therefore, after you call one of these
/// functions, a subsequent call to MsgWaitForMultipleObjects will not return until new input of the specified type arrives. This
/// value is also returned upon the occurrence of a system event that requires the thread's action, such as foreground activation.
/// Therefore, MsgWaitForMultipleObjects can return even though no appropriate input is available and even if dwWakeMask is set to 0.
/// If this occurs, call GetMessage or PeekMessage to process the system event before trying the call to MsgWaitForMultipleObjects again.
/// </term>
/// </item>
/// <item>
/// <term>WAIT_ABANDONED_0 to (WAIT_ABANDONED_0 + nCount 1)</term>
/// <term>
/// If bWaitAll is TRUE, the return value indicates that the state of all specified objects is signaled and at least one of the
/// objects is an abandoned mutex object. If bWaitAll is FALSE, the return value minus WAIT_ABANDONED_0 indicates the pHandles array
/// index of an abandoned mutex object that satisfied the wait. Ownership of the mutex object is granted to the calling thread, and
/// the mutex is set to nonsignaled. If the mutex was protecting persistent state information, you should check it for consistency.
/// </term>
/// </item>
/// <item>
/// <term>WAIT_TIMEOUT 258L</term>
/// <term>The time-out interval elapsed and the conditions specified by the bWaitAll and dwWakeMask parameters were not satisfied.</term>
/// </item>
/// <item>
/// <term>WAIT_FAILED (DWORD)0xFFFFFFFF</term>
/// <term>The function has failed. To get extended error information, call GetLastError.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// The <c>MsgWaitForMultipleObjects</c> function determines whether the wait criteria have been met. If the criteria have not been
/// met, the calling thread enters the wait state until the conditions of the wait criteria have been met or the time-out interval elapses.
/// </para>
/// <para>
/// When bWaitAll is <c>TRUE</c>, the function does not modify the states of the specified objects until the states of all objects
/// have been set to signaled. For example, a mutex can be signaled, but the thread does not get ownership until the states of the
/// other objects have also been set to signaled. In the meantime, some other thread may get ownership of the mutex, thereby setting
/// its state to nonsignaled.
/// </para>
/// <para>
/// When bWaitAll is <c>TRUE</c>, the function's wait is completed only when the states of all objects have been set to signaled and
/// an input event has been received. Therefore, setting bWaitAll to <c>TRUE</c> prevents input from being processed until the state
/// of all objects in the pHandles array have been set to signaled. For this reason, if you set bWaitAll to <c>TRUE</c>, you should
/// use a short timeout value in dwMilliseconds. If you have a thread that creates windows waiting for all objects in the pHandles
/// array, including input events specified by dwWakeMask, with no timeout interval, the system will deadlock. This is because
/// threads that create windows must process messages. DDE sends message to all windows in the system. Therefore, if a thread creates
/// windows, do not set the bWaitAll parameter to <c>TRUE</c> in calls to <c>MsgWaitForMultipleObjects</c> made from that thread.
/// </para>
/// <para>
/// When bWaitAll is <c>FALSE</c>, this function checks the handles in the array in order starting with index 0, until one of the
/// objects is signaled. If multiple objects become signaled, the function returns the index of the first handle in the array whose
/// object was signaled.
/// </para>
/// <para>
/// <c>MsgWaitForMultipleObjects</c> does not return if there is unread input of the specified type in the message queue after the
/// thread has called a function to check the queue. This is because functions such as PeekMessage, GetMessage, GetQueueStatus, and
/// WaitMessage check the queue and then change the state information for the queue so that the input is no longer considered new. A
/// subsequent call to <c>MsgWaitForMultipleObjects</c> will not return until new input of the specified type arrives. The existing
/// unread input (received prior to the last time the thread checked the queue) is ignored.
/// </para>
/// <para>
/// The function modifies the state of some types of synchronization objects. Modification occurs only for the object or objects
/// whose signaled state caused the function to return. For example, the count of a semaphore object is decreased by one. For more
/// information, see the documentation for the individual synchronization objects.
/// </para>
/// <para>
/// The <c>MsgWaitForMultipleObjects</c> function can specify handles of any of the following object types in the pHandles array:
/// </para>
/// <list type="bullet">
/// <item>
/// <term>Change notification</term>
/// </item>
/// <item>
/// <term>Console input</term>
/// </item>
/// <item>
/// <term>Event</term>
/// </item>
/// <item>
/// <term>Memory resource notification</term>
/// </item>
/// <item>
/// <term>Mutex</term>
/// </item>
/// <item>
/// <term>Process</term>
/// </item>
/// <item>
/// <term>Semaphore</term>
/// </item>
/// <item>
/// <term>Thread</term>
/// </item>
/// <item>
/// <term>Waitable timer</term>
/// </item>
/// </list>
/// <para>
/// The <c>QS_ALLPOSTMESSAGE</c> and <c>QS_POSTMESSAGE</c> flags differ in when they are cleared. <c>QS_POSTMESSAGE</c> is cleared
/// when you call GetMessage or PeekMessage, whether or not you are filtering messages. <c>QS_ALLPOSTMESSAGE</c> is cleared when you
/// call <c>GetMessage</c> or PeekMessage without filtering messages (wMsgFilterMin and wMsgFilterMax are 0). This can be useful when
/// you call PeekMessage multiple times to get messages in different ranges.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-msgwaitformultipleobjects DWORD MsgWaitForMultipleObjects(
// DWORD nCount, const HANDLE *pHandles, BOOL fWaitAll, DWORD dwMilliseconds, DWORD dwWakeMask );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "0629f1b3-6805-43a7-9aeb-4f80939ec62c")]
public static extern uint MsgWaitForMultipleObjects(uint nCount, HANDLE[] pHandles, [MarshalAs(UnmanagedType.Bool)] bool fWaitAll, uint dwMilliseconds,
QS dwWakeMask);
/// <summary>
/// <para>
/// Waits until one or all of the specified objects are in the signaled state, an I/O completion routine or asynchronous procedure
/// call (APC) is queued to the thread, or the time-out interval elapses. The array of objects can include input event objects, which
/// you specify using the dwWakeMask parameter.
/// </para>
/// </summary>
/// <param name="nCount">
/// <para>
/// The number of object handles in the array pointed to by pHandles. The maximum number of object handles is
/// <c>MAXIMUM_WAIT_OBJECTS</c> minus one. If this parameter has the value zero, then the function waits only for an input event.
/// </para>
/// </param>
/// <param name="pHandles">
/// <para>
/// An array of object handles. For a list of the object types whose handles you can specify, see the Remarks section later in this
/// topic. The array can contain handles to multiple types of objects. It may not contain multiple copies of the same handle.
/// </para>
/// <para>If one of these handles is closed while the wait is still pending, the function's behavior is undefined.</para>
/// <para>The handles must have the <c>SYNCHRONIZE</c> access right. For more information, see Standard Access Rights.</para>
/// </param>
/// <param name="dwMilliseconds">
/// <para>
/// The time-out interval, in milliseconds. If a nonzero value is specified, the function waits until the specified objects are
/// signaled, an I/O completion routine or APC is queued, or the interval elapses. If dwMilliseconds is zero, the function does not
/// enter a wait state if the criteria is not met; it always returns immediately. If dwMilliseconds is <c>INFINITE</c>, the function
/// will return only when the specified objects are signaled or an I/O completion routine or APC is queued.
/// </para>
/// </param>
/// <param name="dwWakeMask">
/// <para>
/// The input types for which an input event object handle will be added to the array of object handles. This parameter can be one or
/// more of the following values.
/// </para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>QS_ALLEVENTS 0x04BF</term>
/// <term>
/// An input, WM_TIMER, WM_PAINT, WM_HOTKEY, or posted message is in the queue. This value is a combination of QS_INPUT,
/// QS_POSTMESSAGE, QS_TIMER, QS_PAINT, and QS_HOTKEY.
/// </term>
/// </item>
/// <item>
/// <term>QS_ALLINPUT 0x04FF</term>
/// <term>
/// Any message is in the queue. This value is a combination of QS_INPUT, QS_POSTMESSAGE, QS_TIMER, QS_PAINT, QS_HOTKEY, and QS_SENDMESSAGE.
/// </term>
/// </item>
/// <item>
/// <term>QS_ALLPOSTMESSAGE 0x0100</term>
/// <term>A posted message is in the queue. This value is cleared when you call GetMessage or PeekMessage without filtering messages.</term>
/// </item>
/// <item>
/// <term>QS_HOTKEY 0x0080</term>
/// <term>A WM_HOTKEY message is in the queue.</term>
/// </item>
/// <item>
/// <term>QS_INPUT 0x407</term>
/// <term>An input message is in the queue. This value is a combination of QS_MOUSE, QS_KEY, and QS_RAWINPUT.</term>
/// </item>
/// <item>
/// <term>QS_KEY 0x0001</term>
/// <term>A WM_KEYUP, WM_KEYDOWN, WM_SYSKEYUP, or WM_SYSKEYDOWN message is in the queue.</term>
/// </item>
/// <item>
/// <term>QS_MOUSE 0x0006</term>
/// <term>
/// A WM_MOUSEMOVE message or mouse-button message (WM_LBUTTONUP, WM_RBUTTONDOWN, and so on). This value is a combination of
/// QS_MOUSEMOVE and QS_MOUSEBUTTON.
/// </term>
/// </item>
/// <item>
/// <term>QS_MOUSEBUTTON 0x0004</term>
/// <term>A mouse-button message (WM_LBUTTONUP, WM_RBUTTONDOWN, and so on).</term>
/// </item>
/// <item>
/// <term>QS_MOUSEMOVE 0x0002</term>
/// <term>A WM_MOUSEMOVE message is in the queue.</term>
/// </item>
/// <item>
/// <term>QS_PAINT 0x0020</term>
/// <term>A WM_PAINT message is in the queue.</term>
/// </item>
/// <item>
/// <term>QS_POSTMESSAGE 0x0008</term>
/// <term>
/// A posted message is in the queue. This value is cleared when you call GetMessage or PeekMessage, whether or not you are filtering messages.
/// </term>
/// </item>
/// <item>
/// <term>QS_RAWINPUT 0x0400</term>
/// <term>A raw input message is in the queue. For more information, see Raw Input.</term>
/// </item>
/// <item>
/// <term>QS_SENDMESSAGE 0x0040</term>
/// <term>A message sent by another thread or application is in the queue.</term>
/// </item>
/// <item>
/// <term>QS_TIMER 0x0010</term>
/// <term>A WM_TIMER message is in the queue.</term>
/// </item>
/// </list>
/// </param>
/// <param name="dwFlags">
/// <para>The wait type. This parameter can be one or more of the following values.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>0</term>
/// <term>
/// The function returns when any one of the objects is signaled. The return value indicates the object whose state caused the
/// function to return.
/// </term>
/// </item>
/// <item>
/// <term>MWMO_ALERTABLE 0x0002</term>
/// <term>
/// The function also returns if an APC has been queued to the thread with QueueUserAPC while the thread is in the waiting state.
/// </term>
/// </item>
/// <item>
/// <term>MWMO_INPUTAVAILABLE 0x0004</term>
/// <term>
/// The function returns if input exists for the queue, even if the input has been seen (but not removed) using a call to another
/// function, such as PeekMessage.
/// </term>
/// </item>
/// <item>
/// <term>MWMO_WAITALL 0x0001</term>
/// <term>
/// The function returns when all objects in the pHandles array are signaled and an input event has been received, all at the same time.
/// </term>
/// </item>
/// </list>
/// </param>
/// <returns>
/// <para>
/// If the function succeeds, the return value indicates the event that caused the function to return. It can be one of the following
/// values. (Note that <c>WAIT_OBJECT_0</c> is defined as 0 and <c>WAIT_ABANDONED_0</c> is defined as 0x00000080L.)
/// </para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term>WAIT_OBJECT_0 to (WAIT_OBJECT_0 + nCount - 1)</term>
/// <term>
/// If the MWMO_WAITALL flag is used, the return value indicates that the state of all specified objects is signaled. Otherwise, the
/// return value minus WAIT_OBJECT_0 indicates the pHandles array index of the object that caused the function to return.
/// </term>
/// </item>
/// <item>
/// <term>WAIT_OBJECT_0 + nCount</term>
/// <term>
/// New input of the type specified in the dwWakeMask parameter is available in the thread's input queue. Functions such as
/// PeekMessage, GetMessage, GetQueueStatus, and WaitMessage mark messages in the queue as old messages. Therefore, after you call
/// one of these functions, a subsequent call to MsgWaitForMultipleObjectsEx will not return until new input of the specified type
/// arrives. This value is also returned upon the occurrence of a system event that requires the thread's action, such as foreground
/// activation. Therefore, MsgWaitForMultipleObjectsEx can return even though no appropriate input is available and even if
/// dwWakeMask is set to 0. If this occurs, call GetMessage or PeekMessage to process the system event before trying the call to
/// MsgWaitForMultipleObjectsEx again.
/// </term>
/// </item>
/// <item>
/// <term>WAIT_ABANDONED_0 to (WAIT_ABANDONED_0 + nCount - 1)</term>
/// <term>
/// If the MWMO_WAITALL flag is used, the return value indicates that the state of all specified objects is signaled and at least one
/// of the objects is an abandoned mutex object. Otherwise, the return value minus WAIT_ABANDONED_0 indicates the pHandles array
/// index of an abandoned mutex object that caused the function to return. Ownership of the mutex object is granted to the calling
/// thread, and the mutex is set to nonsignaled. If the mutex was protecting persistent state information, you should check it for consistency.
/// </term>
/// </item>
/// <item>
/// <term>WAIT_IO_COMPLETION 0x000000C0L</term>
/// <term>The wait was ended by one or more user-mode asynchronous procedure calls (APC) queued to the thread.</term>
/// </item>
/// <item>
/// <term>WAIT_TIMEOUT 258L</term>
/// <term>The time-out interval elapsed, but the conditions specified by the dwFlags and dwWakeMask parameters were not met.</term>
/// </item>
/// <item>
/// <term>WAIT_FAILED (DWORD)0xFFFFFFFF</term>
/// <term>The function has failed. To get extended error information, call GetLastError.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// The <c>MsgWaitForMultipleObjectsEx</c> function determines whether the conditions specified by dwWakeMask and dwFlags have been
/// met. If the conditions have not been met, the calling thread enters the wait state until the conditions of the wait criteria have
/// been met or the time-out interval elapses.
/// </para>
/// <para>
/// When dwFlags is zero, this function checks the handles in the array in order starting with index 0, until one of the objects is
/// signaled. If multiple objects become signaled, the function returns the index of the first handle in the array whose object was signaled.
/// </para>
/// <para>
/// <c>MsgWaitForMultipleObjectsEx</c> does not return if there is unread input of the specified type in the message queue after the
/// thread has called a function to check the queue, unless you use the <c>MWMO_INPUTAVAILABLE</c> flag. This is because functions
/// such as PeekMessage, GetMessage, GetQueueStatus, and WaitMessage check the queue and then change the state information for the
/// queue so that the input is no longer considered new. A subsequent call to <c>MsgWaitForMultipleObjectsEx</c> will not return
/// until new input of the specified type arrives, unless you use the <c>MWMO_INPUTAVAILABLE</c> flag. If this flag is not used, the
/// existing unread input (received prior to the last time the thread checked the queue) is ignored.
/// </para>
/// <para>
/// The function modifies the state of some types of synchronization objects. Modification occurs only for the object or objects
/// whose signaled state caused the function to return. For example, the system decreases the count of a semaphore object by one. For
/// more information, see the documentation for the individual synchronization objects.
/// </para>
/// <para>
/// The <c>MsgWaitForMultipleObjectsEx</c> function can specify handles of any of the following object types in the pHandles array:
/// </para>
/// <list type="bullet">
/// <item>
/// <term>Change notification</term>
/// </item>
/// <item>
/// <term>Console input</term>
/// </item>
/// <item>
/// <term>Event</term>
/// </item>
/// <item>
/// <term>Memory resource notification</term>
/// </item>
/// <item>
/// <term>Mutex</term>
/// </item>
/// <item>
/// <term>Process</term>
/// </item>
/// <item>
/// <term>Semaphore</term>
/// </item>
/// <item>
/// <term>Thread</term>
/// </item>
/// <item>
/// <term>Waitable timer</term>
/// </item>
/// </list>
/// <para>
/// The <c>QS_ALLPOSTMESSAGE</c> and <c>QS_POSTMESSAGE</c> flags differ in when they are cleared. <c>QS_POSTMESSAGE</c> is cleared
/// when you call GetMessage or PeekMessage, whether or not you are filtering messages. <c>QS_ALLPOSTMESSAGE</c> is cleared when you
/// call <c>GetMessage</c> or <c>PeekMessage</c> without filtering messages (wMsgFilterMin and wMsgFilterMax are 0). This can be
/// useful when you call <c>PeekMessage</c> multiple times to get messages in different ranges.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-msgwaitformultipleobjectsex DWORD
// MsgWaitForMultipleObjectsEx( DWORD nCount, const HANDLE *pHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "1774b721-3ad4-492e-96af-b71de9066f0c")]
public static extern uint MsgWaitForMultipleObjectsEx(uint nCount, HANDLE[] pHandles, uint dwMilliseconds, QS dwWakeMask, MWMO dwFlags);
/// <summary>Packs a Dynamic Data Exchange (DDE) lParam value into an internal structure used for sharing DDE data between processes.</summary>
/// <param name="msg">
/// <para>Type: <c>UINT</c></para>
/// <para>The DDE message to be posted.</para>
/// </param>
/// <param name="uiLo">
/// <para>Type: <c>UINT_PTR</c></para>
/// <para>A value that corresponds to the 16-bit Windows low-order word of an lParam parameter for the DDE message being posted.</para>
/// </param>
/// <param name="uiHi">
/// <para>Type: <c>UINT_PTR</c></para>
/// <para>A value that corresponds to the 16-bit Windows high-order word of an lParam parameter for the DDE message being posted.</para>
/// </param>
/// <returns>
/// <para>Type: <c>LPARAM</c></para>
/// <para>The return value is the lParam value.</para>
/// </returns>
/// <remarks>
/// <para>
/// The return value must be posted as the lParam parameter of a DDE message; it must not be used for any other purpose. After the
/// application posts a return value, it need not perform any action to dispose of the lParam parameter.
/// </para>
/// <para>An application should call this function only for posted DDE messages.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/dde/nf-dde-packddelparam LPARAM PackDDElParam( UINT msg, UINT_PTR uiLo,
// UINT_PTR uiHi );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("dde.h", MSDNShortId = "")]
public static extern IntPtr PackDDElParam(uint msg, IntPtr uiLo, IntPtr uiHi);
/// <summary>
/// Dispatches incoming sent messages, checks the thread message queue for a posted message, and retrieves the message (if any exist).
/// </summary>
@ -1370,6 +1982,54 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ReplyMessage(IntPtr lResult);
/// <summary>
/// Enables an application to reuse a packed Dynamic Data Exchange (DDE) lParam parameter, rather than allocating a new packed
/// lParam. Using this function reduces reallocations for applications that pass packed DDE messages.
/// </summary>
/// <param name="lParam">
/// <para>Type: <c>LPARAM</c></para>
/// <para>The lParam parameter of the posted DDE message being reused.</para>
/// </param>
/// <param name="msgIn">
/// <para>Type: <c>UINT</c></para>
/// <para>The identifier of the received DDE message.</para>
/// </param>
/// <param name="msgOut">
/// <para>Type: <c>UINT</c></para>
/// <para>The identifier of the DDE message to be posted. The DDE message will reuse the packed lParam parameter.</para>
/// </param>
/// <param name="uiLo">
/// <para>Type: <c>UINT_PTR</c></para>
/// <para>The value to be packed into the low-order word of the reused lParam parameter.</para>
/// </param>
/// <param name="uiHi">
/// <para>Type: <c>UINT_PTR</c></para>
/// <para>The value to be packed into the high-order word of the reused lParam parameter.</para>
/// </param>
/// <returns>
/// <para>Type: <c>LPARAM</c></para>
/// <para>The return value is the new lParam value.</para>
/// </returns>
/// <remarks>
/// <para>
/// The return value must be posted as the lParam parameter of a DDE message; it must not be used for any other purpose. Once the
/// return value is posted, the posting application need not perform any action to dispose of the lParam parameter.
/// </para>
/// <para>
/// Use <c>ReuseDDElParam</c> instead of FreeDDElParam if the lParam parameter will be reused in a responding message.
/// <c>ReuseDDElParam</c> returns the lParam appropriate for reuse.
/// </para>
/// <para>
/// This function allocates or frees lParam parameters as needed, depending on the packing requirements of the incoming and outgoing
/// messages. This reduces reallocations in passing DDE messages.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/dde/nf-dde-reuseddelparam LPARAM ReuseDDElParam( LPARAM lParam, UINT msgIn,
// UINT msgOut, UINT_PTR uiLo, UINT_PTR uiHi );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("dde.h", MSDNShortId = "")]
public static extern IntPtr ReuseDDElParam(IntPtr lParam, uint msgIn, uint msgOut, IntPtr uiLo, IntPtr uiHi);
/// <summary>
/// <para>
/// Sends the specified message to a window or windows. The <c>SendMessage</c> function calls the window procedure for the specified
@ -1593,7 +2253,7 @@ namespace Vanara.PInvoke
where TEnum : struct, IConvertible where TWP : struct where TLP : class
{
using (PinnedObject wp = new PinnedObject(wParam), lp = new PinnedObject(lParam))
return SendMessage(hWnd, Convert.ToUInt32(msg), wp, (IntPtr)lp);
return SendMessage(hWnd, Convert.ToUInt32(msg), wp, lp);
}
/// <summary>
@ -1623,40 +2283,6 @@ namespace Vanara.PInvoke
}
}
/// <summary>
/// <para>
/// Sends the specified message to a window or windows. The <c>SendMessage</c> function calls the window procedure for the specified
/// window and does not return until the window procedure has processed the message.
/// </para>
/// <para>
/// To send a message and return immediately, use the <c>SendMessageCallback</c> or <c>SendNotifyMessage</c> function. To post a
/// message to a thread's message queue and return immediately, use the <c>PostMessage</c> or <c>PostThreadMessage</c> function.
/// </para>
/// </summary>
/// <param name="hWnd">
/// <para>
/// A handle to the window whose window procedure will receive the message. If this parameter is <c>HWND_BROADCAST</c>
/// ((HWND)0xffff), the message is sent to all top-level windows in the system, including disabled or invisible unowned windows,
/// overlapped windows, and pop-up windows; but the message is not sent to child windows.
/// </para>
/// <para>
/// Message sending is subject to UIPI. The thread of a process can send messages only to message queues of threads in processes of
/// lesser or equal integrity level.
/// </para>
/// </param>
/// <param name="msg">
/// <para>The message to be sent.</para>
/// <para>For lists of the system-provided messages, see System-Defined Messages.</para>
/// </param>
/// <param name="wParam">Additional message-specific information.</param>
/// <param name="lParam">Additional message-specific information.</param>
/// <returns>The return value specifies the result of the message processing; it depends on the message sent.</returns>
// LRESULT WINAPI SendMessage( _In_ HWND hWnd, _In_ UINT Msg, _In_ WPARAM wParam, _In_ LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx
[DllImport(Lib.User32, SetLastError = false, CharSet = CharSet.Auto, EntryPoint = "SendMessage")]
[PInvokeData("Winuser.h", MSDNShortId = "ms644950")]
[System.Security.SecurityCritical]
public static unsafe extern void* SendMessageUnsafe(void* hWnd, uint msg, void* wParam, void* lParam);
/// <summary>
/// Sends the specified message to a window or windows. It calls the window procedure for the specified window and returns
/// immediately if the window belongs to another thread. After the window procedure processes the message, the system calls the
@ -1832,6 +2458,40 @@ namespace Vanara.PInvoke
[PInvokeData("winuser.h")]
public static extern IntPtr SendMessageTimeout(HWND hWnd, uint Msg, [Optional] IntPtr wParam, [Optional] IntPtr lParam, SMTO fuFlags, uint uTimeout, ref IntPtr lpdwResult);
/// <summary>
/// <para>
/// Sends the specified message to a window or windows. The <c>SendMessage</c> function calls the window procedure for the specified
/// window and does not return until the window procedure has processed the message.
/// </para>
/// <para>
/// To send a message and return immediately, use the <c>SendMessageCallback</c> or <c>SendNotifyMessage</c> function. To post a
/// message to a thread's message queue and return immediately, use the <c>PostMessage</c> or <c>PostThreadMessage</c> function.
/// </para>
/// </summary>
/// <param name="hWnd">
/// <para>
/// A handle to the window whose window procedure will receive the message. If this parameter is <c>HWND_BROADCAST</c>
/// ((HWND)0xffff), the message is sent to all top-level windows in the system, including disabled or invisible unowned windows,
/// overlapped windows, and pop-up windows; but the message is not sent to child windows.
/// </para>
/// <para>
/// Message sending is subject to UIPI. The thread of a process can send messages only to message queues of threads in processes of
/// lesser or equal integrity level.
/// </para>
/// </param>
/// <param name="msg">
/// <para>The message to be sent.</para>
/// <para>For lists of the system-provided messages, see System-Defined Messages.</para>
/// </param>
/// <param name="wParam">Additional message-specific information.</param>
/// <param name="lParam">Additional message-specific information.</param>
/// <returns>The return value specifies the result of the message processing; it depends on the message sent.</returns>
// LRESULT WINAPI SendMessage( _In_ HWND hWnd, _In_ UINT Msg, _In_ WPARAM wParam, _In_ LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx
[DllImport(Lib.User32, SetLastError = false, CharSet = CharSet.Auto, EntryPoint = "SendMessage")]
[PInvokeData("Winuser.h", MSDNShortId = "ms644950")]
[System.Security.SecurityCritical]
public static unsafe extern void* SendMessageUnsafe(void* hWnd, uint msg, void* wParam, void* lParam);
/// <summary>
/// Sends the specified message to a window or windows. If the window was created by the calling thread, <c>SendNotifyMessage</c>
/// calls the window procedure for the window and does not return until the window procedure has processed the message. If the window
@ -1951,6 +2611,39 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool TranslateMessage(in MSG lpMsg);
/// <summary>Unpacks a Dynamic Data Exchange (DDE)lParam value received from a posted DDE message.</summary>
/// <param name="msg">
/// <para>Type: <c>UINT</c></para>
/// <para>The posted DDE message.</para>
/// </param>
/// <param name="lParam">
/// <para>Type: <c>LPARAM</c></para>
/// <para>
/// The lParam parameter of the posted DDE message that was received. The application must free the memory object specified by the
/// lParam parameter by calling the FreeDDElParam function.
/// </para>
/// </param>
/// <param name="puiLo">
/// <para>Type: <c>PUINT_PTR</c></para>
/// <para>A pointer to a variable that receives the low-order word of lParam.</para>
/// </param>
/// <param name="puiHi">
/// <para>Type: <c>PUINT_PTR</c></para>
/// <para>A pointer to a variable that receives the high-order word of lParam.</para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>PackDDElParam eases the porting of 16-bit DDE applications to 32-bit DDE applications.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/dde/nf-dde-unpackddelparam BOOL UnpackDDElParam( UINT msg, LPARAM lParam,
// PUINT_PTR puiLo, PUINT_PTR puiHi );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("dde.h", MSDNShortId = "")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UnpackDDElParam(uint msg, IntPtr lParam, out IntPtr puiLo, out IntPtr puiHi);
/// <summary>
/// Yields control to other threads when a thread has no other messages in its message queue. The <c>WaitMessage</c> function
/// suspends the thread and does not return until a new message is placed in the thread's message queue.

View File

@ -1120,64 +1120,75 @@ namespace Vanara.PInvoke
/// <para>Examples</para>
/// <para>For an example, see Using Rectangles.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-fillrect
// int FillRect( HDC hDC, const RECT *lprc, HBRUSH hbr );
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-fillrect int FillRect( HDC hDC, const RECT *lprc, HBRUSH
// hbr );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "98ab34da-ea07-4446-a62e-509c849d95f9")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FillRect(HDC hDC, in RECT lprc, HBRUSH hbr);
/// <summary>
/// The <c>FrameRect</c> function draws a border around the specified rectangle by using the specified brush. The width and height of the border are always one logical unit.
/// The <c>FrameRect</c> function draws a border around the specified rectangle by using the specified brush. The width and height of
/// the border are always one logical unit.
/// </summary>
/// <param name="hDC">A handle to the device context in which the border is drawn.</param>
/// <param name="lprc">A pointer to a RECT structure that contains the logical coordinates of the upper-left and lower-right corners of the rectangle.</param>
/// <param name="lprc">
/// A pointer to a RECT structure that contains the logical coordinates of the upper-left and lower-right corners of the rectangle.
/// </param>
/// <param name="hbr">A handle to the brush used to draw the border.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para><para>If the function fails, the return value is zero.</para>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>The brush identified by the hbr parameter must have been created by using the CreateHatchBrush, CreatePatternBrush, or CreateSolidBrush function, or retrieved by using the GetStockObject function.</para><para>If the <c>bottom</c> member of the RECT structure is less than the <c>top</c> member, or if the <c>right</c> member is less than the <c>left</c> member, the function does not draw the rectangle.</para>
/// <para>
/// The brush identified by the hbr parameter must have been created by using the CreateHatchBrush, CreatePatternBrush, or
/// CreateSolidBrush function, or retrieved by using the GetStockObject function.
/// </para>
/// <para>
/// If the <c>bottom</c> member of the RECT structure is less than the <c>top</c> member, or if the <c>right</c> member is less than
/// the <c>left</c> member, the function does not draw the rectangle.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-framerect
// int FrameRect( HDC hDC, const RECT *lprc, HBRUSH hbr );
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-framerect int FrameRect( HDC hDC, const RECT *lprc, HBRUSH
// hbr );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "a1083cb5-5e6c-4134-badf-9fc5142d1453")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FrameRect(HDC hDC, in RECT lprc, HBRUSH hbr);
/// <summary>
/// The <c>GetUpdateRect</c> function retrieves the coordinates of the smallest rectangle that completely encloses the update region
/// of the specified window. <c>GetUpdateRect</c> retrieves the rectangle in logical coordinates. If there is no update region,
/// <c>GetUpdateRect</c> retrieves an empty rectangle (sets all coordinates to zero).
/// </summary>
/// <param name="hWnd">Handle to the window whose update region is to be retrieved.</param>
/// <param name="lpRect">
/// <para>Pointer to the RECT structure that receives the coordinates, in device units, of the enclosing rectangle.</para>
/// <para>
/// An application can set this parameter to <c>NULL</c> to determine whether an update region exists for the window. If this
/// parameter is <c>NULL</c>, <c>GetUpdateRect</c> returns nonzero if an update region exists, and zero if one does not. This
/// provides a simple and efficient means of determining whether a <c>WM_PAINT</c> message resulted from an invalid area.
/// </para>
/// </param>
/// <param name="bErase">
/// Specifies whether the background in the update region is to be erased. If this parameter is <c>TRUE</c> and the update region is
/// not empty, <c>GetUpdateRect</c> sends a <c>WM_ERASEBKGND</c> message to the specified window to erase the background.
/// </param>
/// <returns>
/// <para>If the update region is not empty, the return value is nonzero.</para>
/// <para>If there is no update region, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>The update rectangle retrieved by the BeginPaint function is identical to that retrieved by <c>GetUpdateRect</c>.</para>
/// <para>
/// BeginPaint automatically validates the update region, so any call to <c>GetUpdateRect</c> made immediately after the call to
/// <c>BeginPaint</c> retrieves an empty update region.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getupdaterect BOOL GetUpdateRect( HWND hWnd, LPRECT
// lpRect, BOOL bErase );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
/// <summary>
/// The <c>GetUpdateRect</c> function retrieves the coordinates of the smallest rectangle that completely encloses the update region
/// of the specified window. <c>GetUpdateRect</c> retrieves the rectangle in logical coordinates. If there is no update region,
/// <c>GetUpdateRect</c> retrieves an empty rectangle (sets all coordinates to zero).
/// </summary>
/// <param name="hWnd">Handle to the window whose update region is to be retrieved.</param>
/// <param name="lpRect">
/// <para>Pointer to the RECT structure that receives the coordinates, in device units, of the enclosing rectangle.</para>
/// <para>
/// An application can set this parameter to <c>NULL</c> to determine whether an update region exists for the window. If this
/// parameter is <c>NULL</c>, <c>GetUpdateRect</c> returns nonzero if an update region exists, and zero if one does not. This
/// provides a simple and efficient means of determining whether a <c>WM_PAINT</c> message resulted from an invalid area.
/// </para>
/// </param>
/// <param name="bErase">
/// Specifies whether the background in the update region is to be erased. If this parameter is <c>TRUE</c> and the update region is
/// not empty, <c>GetUpdateRect</c> sends a <c>WM_ERASEBKGND</c> message to the specified window to erase the background.
/// </param>
/// <returns>
/// <para>If the update region is not empty, the return value is nonzero.</para>
/// <para>If there is no update region, the return value is zero.</para>
/// </returns>
/// <remarks>
/// <para>The update rectangle retrieved by the BeginPaint function is identical to that retrieved by <c>GetUpdateRect</c>.</para>
/// <para>
/// BeginPaint automatically validates the update region, so any call to <c>GetUpdateRect</c> made immediately after the call to
/// <c>BeginPaint</c> retrieves an empty update region.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getupdaterect BOOL GetUpdateRect( HWND hWnd, LPRECT
// lpRect, BOOL bErase );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "e54483a1-8738-4b22-a24e-c0b31f6ca9d6")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetUpdateRect(HWND hWnd, PRECT lpRect, [MarshalAs(UnmanagedType.Bool)] bool bErase);

View File

@ -0,0 +1,230 @@
using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class User32_Gdi
{
/// <summary>Registers the application to receive power setting notifications for the specific power setting event.</summary>
/// <param name="hRecipient">
/// Handle indicating where the power setting notifications are to be sent. For interactive applications, the Flags parameter should
/// be zero, and the hRecipient parameter should be a window handle. For services, the Flags parameter should be one, and the
/// hRecipient parameter should be a <c>SERVICE_STATUS_HANDLE</c> as returned from RegisterServiceCtrlHandlerEx.
/// </param>
/// <param name="PowerSettingGuid">
/// The <c>GUID</c> of the power setting for which notifications are to be sent. For more information see Registering for Power Events.
/// </param>
/// <param name="Flags">
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>DEVICE_NOTIFY_WINDOW_HANDLE 0</term>
/// <term>Notifications are sent using WM_POWERBROADCAST messages with a wParam parameter of PBT_POWERSETTINGCHANGE.</term>
/// </item>
/// <item>
/// <term>DEVICE_NOTIFY_SERVICE_HANDLE 1</term>
/// <term>
/// Notifications are sent to the HandlerEx callback function with a dwControl parameter of SERVICE_CONTROL_POWEREVENT and a
/// dwEventType of PBT_POWERSETTINGCHANGE.
/// </term>
/// </item>
/// </list>
/// </param>
/// <returns>
/// Returns a notification handle for unregistering for power notifications. If the function fails, the return value is NULL. To get
/// extended error information, call GetLastError.
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registerpowersettingnotification HPOWERNOTIFY
// RegisterPowerSettingNotification( IN HANDLE hRecipient, IN LPCGUID PowerSettingGuid, IN DWORD Flags );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "e072222e-da66-4b36-a38f-f4b618eaa391")]
public static extern SafeHPOWERSETTINGNOTIFY RegisterPowerSettingNotification([In] HANDLE hRecipient, in Guid PowerSettingGuid, [In] DEVICE_NOTIFY Flags);
/// <summary>
/// Registers to receive notification when the system is suspended or resumed. Similar to PowerRegisterSuspendResumeNotification, but
/// operates in user mode and can take a window handle.
/// </summary>
/// <param name="hRecipient">
/// <para>
/// This parameter contains parameters for subscribing to a power notification or a window handle representing the subscribing process.
/// </para>
/// <para>
/// If Flags is <c>DEVICE_NOTIFY_CALLBACK</c>, hRecipient is interpreted as a pointer to a DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS
/// structure. In this case, the callback function is DeviceNotifyCallbackRoutine. When the <c>Callback</c> function executes, the
/// Type parameter is set indicating the type of event that occurred. Possible values include <c>PBT_APMSUSPEND</c>,
/// <c>PBT_APMRESUMESUSPEND</c>, and <c>PBT_APMRESUMEAUTOMATIC</c> - see Power Management Events for more info. The Setting parameter
/// is not used with suspend/resume notifications.
/// </para>
/// <para>If Flags is <c>DEVICE_NOTIFY_WINDOW_HANDLE</c>, hRecipient is a handle to the window to deliver events to.</para>
/// </param>
/// <param name="Flags">This parameter can be <c>DEVICE_NOTIFY_WINDOW_HANDLE</c> or <c>DEVICE_NOTIFY_CALLBACK</c>.</param>
/// <returns>
/// <para>A handle to the registration. Use this handle to unregister for notifications.</para>
/// <para>If the function fails, the return value is NULL. To get extended error information call GetLastError.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registersuspendresumenotification HPOWERNOTIFY
// RegisterSuspendResumeNotification( IN HANDLE hRecipient, IN DWORD Flags );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "6cd42d32-07e9-4cbd-83f9-6146b1cb54db")]
public static extern SafeHSUSPRESUMENOTIFY RegisterSuspendResumeNotification([In] HANDLE hRecipient, [In] DEVICE_NOTIFY Flags);
/// <summary>Unregisters the power setting notification.</summary>
/// <param name="Handle">The handle returned from the RegisterPowerSettingNotification function.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-unregisterpowersettingnotification BOOL
// UnregisterPowerSettingNotification( IN HPOWERNOTIFY Handle );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "de1509f5-cf4c-448e-bb3b-08da6be53bfa")]
[return: MarshalAs(UnmanagedType.Bool)] public static extern bool UnregisterPowerSettingNotification([In] HANDLE Handle);
/// <summary>
/// Cancels a registration to receive notification when the system is suspended or resumed. Similar to
/// PowerUnregisterSuspendResumeNotification but operates in user mode.
/// </summary>
/// <param name="Handle">A handle to a registration obtained by calling the RegisterSuspendResumeNotification function.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-unregistersuspendresumenotification BOOL
// UnregisterSuspendResumeNotification( IN HPOWERNOTIFY Handle );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "d9307452-9670-4e9c-9df8-6a3b41d0bd2e")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UnregisterSuspendResumeNotification([In] HANDLE Handle);
/// <summary>Provides a <see cref="SafeHandle"/> for <c>HPOWERNOTIFY</c> that is disposed using <see cref="UnregisterPowerSettingNotification"/>.</summary>
public class SafeHPOWERSETTINGNOTIFY : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHPOWERSETTINGNOTIFY"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
/// <param name="ownsHandle">
/// <see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).
/// </param>
public SafeHPOWERSETTINGNOTIFY(IntPtr preexistingHandle, bool ownsHandle = true) : base(preexistingHandle, ownsHandle) { }
/// <summary>Initializes a new instance of the <see cref="SafeHPOWERSETTINGNOTIFY"/> class.</summary>
private SafeHPOWERSETTINGNOTIFY() : base() { }
/// <inheritdoc/>
protected override bool InternalReleaseHandle() => UnregisterPowerSettingNotification(handle);
}
/// <summary>Provides a <see cref="SafeHandle"/> for <c>HPOWERNOTIFY</c> that is disposed using <see cref="UnregisterSuspendResumeNotification"/>.</summary>
public class SafeHSUSPRESUMENOTIFY : SafeHANDLE
{
/// <summary>Initializes a new instance of the <see cref="SafeHSUSPRESUMENOTIFY"/> class and assigns an existing handle.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
/// <param name="ownsHandle">
/// <see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).
/// </param>
public SafeHSUSPRESUMENOTIFY(IntPtr preexistingHandle, bool ownsHandle = true) : base(preexistingHandle, ownsHandle) { }
/// <summary>Initializes a new instance of the <see cref="SafeHSUSPRESUMENOTIFY"/> class.</summary>
private SafeHSUSPRESUMENOTIFY() : base() { }
/// <inheritdoc/>
protected override bool InternalReleaseHandle() => UnregisterSuspendResumeNotification(handle);
}
/*
CallNtPowerInformation
CanUserWritePwrScheme
DeletePwrScheme
DeviceNotifyCallbackRoutine
DevicePowerClose
DevicePowerEnumDevices
DevicePowerOpen
DevicePowerSetDeviceState
EnumPwrSchemes
EFFECTIVE_POWER_MODE_CALLBACK
GetActivePwrScheme
GetCurrentPowerPolicies
GetDevicePowerState
GetPwrCapabilities
GetPwrDiskSpindownRange
GetSystemPowerStatus
IsPwrHibernateAllowed
IsPwrShutdownAllowed
IsPwrSuspendAllowed
IsSystemResumeAutomatic
PowerCanRestoreIndividualDefaultPowerScheme
PowerClearRequest
PowerCreatePossibleSetting
PowerCreateRequest
PowerCreateSetting
PowerDeleteScheme
PowerDeterminePlatformRole
PowerDeterminePlatformRoleEx
PowerDuplicateScheme
PowerEnumerate
PowerGetActiveScheme
PowerImportPowerScheme
PowerIsSettingRangeDefined
PowerReadACDefaultIndex
PowerReadACValue
PowerReadACValueIndex
PowerReadDCDefaultIndex
PowerReadDCValue
PowerReadDCValueIndex
PowerReadDescription
PowerReadFriendlyName
PowerReadIconResourceSpecifier
PowerReadPossibleDescription
PowerReadPossibleFriendlyName
PowerReadPossibleValue
PowerReadSettingAttributes
PowerReadValueIncrement
PowerReadValueMax
PowerReadValueMin
PowerReadValueUnitsSpecifier
PowerRegisterForEffectivePowerModeNotifications
PowerRegisterSuspendResumeNotification
PowerRemovePowerSetting
PowerReplaceDefaultPowerSchemes
PowerReportThermalEvent
PowerRestoreDefaultPowerSchemes
PowerRestoreIndividualDefaultPowerScheme
PowerSetActiveScheme
PowerSetRequest
PowerSettingAccessCheck
PowerSettingAccessCheckEx
PowerSettingRegisterNotification
PowerSettingUnregisterNotification
PowerUnregisterFromEffectivePowerModeNotifications
PowerUnregisterSuspendResumeNotification
PowerWriteACDefaultIndex
PowerWriteACValueIndex
PowerWriteDCDefaultIndex
PowerWriteDCValueIndex
PowerWriteDescription
PowerWriteFriendlyName
PowerWriteIconResourceSpecifier
PowerWritePossibleDescription
PowerWritePossibleFriendlyName
PowerWritePossibleValue
PowerWriteSettingAttributes
PowerWriteValueIncrement
PowerWriteValueMax
PowerWriteValueMin
PowerWriteValueUnitsSpecifier
ReadGlobalPwrPolicy
ReadProcessorPwrScheme
ReadPwrScheme
RequestWakeupLatency
SetActivePwrScheme
SetSuspendState
SetSystemPowerState
SetThreadExecutionState
WriteGlobalPwrPolicy
WriteProcessorPwrScheme
WritePwrScheme
*/
}
}

View File

@ -107,6 +107,27 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IntersectRect(out RECT lprcDst, in RECT lprcSrc1, in RECT lprcSrc2);
/// <summary>
/// The <c>InvertRect</c> function inverts a rectangle in a window by performing a logical NOT operation on the color values for each
/// pixel in the rectangle's interior.
/// </summary>
/// <param name="hDC">A handle to the device context.</param>
/// <param name="lprc">A pointer to a RECT structure that contains the logical coordinates of the rectangle to be inverted.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero.</para>
/// </returns>
/// <remarks>
/// On monochrome screens, <c>InvertRect</c> makes white pixels black and black pixels white. On color screens, the inversion depends
/// on how colors are generated for the screen. Calling <c>InvertRect</c> twice for the same rectangle restores the display to its
/// previous colors.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-invertrect BOOL InvertRect( HDC hDC, const RECT *lprc );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "a8c4dbf1-94ec-46e9-b365-7dfc89e4f176")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool InvertRect(HDC hDC, ref RECT lprc);
/// <summary>
/// The <c>IsRectEmpty</c> function determines whether the specified rectangle is empty. An empty rectangle is one that has no area;
/// that is, the coordinate of the right side is less than or equal to the coordinate of the left side, or the coordinate of the

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
## Correlation report for user32.dll
### Methods (79% complete)
### Methods (100% complete)
Native Method | Native DLL | Header | Managed Method
--- | --- | --- | ---
[ActivateKeyboardLayout](https://www.google.com/search?num=5&q=ActivateKeyboardLayout+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.ActivateKeyboardLayout
@ -14,7 +14,7 @@ Native Method | Native DLL | Header | Managed Method
[AppendMenuW](http://msdn2.microsoft.com/en-us/library/appendmenu) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.AppendMenu
[AreDpiAwarenessContextsEqual](http://msdn2.microsoft.com/en-us/library/77660CAB-97ED-4DAC-A95E-A149F1A479FD) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.AreDpiAwarenessContextsEqual
[ArrangeIconicWindows](http://msdn2.microsoft.com/en-us/library/arrangeiconicwindows) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ArrangeIconicWindows
[AttachThreadInput](https://www.google.com/search?num=5&q=AttachThreadInput+site%3Amicrosoft.com) | user32.dll | |
[AttachThreadInput](http://msdn2.microsoft.com/en-us/library/0c343fab-56ae-4c70-a79e-0c5f827158a3) | user32.dll | winuser.h | Vanara.PInvoke.User32.AttachThreadInput
[BeginDeferWindowPos](http://msdn2.microsoft.com/en-us/library/begindeferwindowpos) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.BeginDeferWindowPos
[BeginPaint](http://msdn2.microsoft.com/en-us/library/513341d7-bed8-469c-a067-ee71dc8860f9) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.BeginPaint
[BlockInput](https://www.google.com/search?num=5&q=BlockInput+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.BlockInput
@ -24,17 +24,15 @@ Native Method | Native DLL | Header | Managed Method
[CalculatePopupWindowPosition](http://msdn2.microsoft.com/en-us/library/calculatepopupwindowposition) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.CalculatePopupWindowPosition
[CallMsgFilter](https://www.google.com/search?num=5&q=CallMsgFilter+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.CallMsgFilter
[CallNextHookEx](http://msdn2.microsoft.com/en-us/library/callnexthookex) | user32.dll | winuser.h | Vanara.PInvoke.User32.CallNextHookEx
[CallWindowProc](https://www.google.com/search?num=5&q=CallWindowProcA+site%3Amicrosoft.com) | user32.dll | |
[CallWindowProc](https://www.google.com/search?num=5&q=CallWindowProcA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.CallWindowProc
[CascadeWindows](http://msdn2.microsoft.com/en-us/library/cascadewindows) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.CascadeWindows
[ChangeClipboardChain](http://msdn2.microsoft.com/en-us/library/changeclipboardchain) | user32.dll | winuser.h | Vanara.PInvoke.User32.ChangeClipboardChain
[ChangeDisplaySettings](http://msdn2.microsoft.com/en-us/library/208bf1cc-c03c-4d03-92e4-32fcf856b4d8) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ChangeDisplaySettings
[ChangeDisplaySettingsEx](http://msdn2.microsoft.com/en-us/library/1448e04c-1452-4eab-bda4-4d249cb67a24) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ChangeDisplaySettingsEx
[ChangeWindowMessageFilter](http://msdn2.microsoft.com/en-us/library/changewindowmessagefilter) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ChangeWindowMessageFilter
[ChangeWindowMessageFilterEx](http://msdn2.microsoft.com/en-us/library/changewindowmessagefilterex) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ChangeWindowMessageFilterEx
[CharNextExA](https://www.google.com/search?num=5&q=CharNextExA+site%3Amicrosoft.com) | user32.dll | |
[CharPrevExA](https://www.google.com/search?num=5&q=CharPrevExA+site%3Amicrosoft.com) | user32.dll | |
[CharToOem](https://www.google.com/search?num=5&q=CharToOemA+site%3Amicrosoft.com) | user32.dll | |
[CharToOemBuff](https://www.google.com/search?num=5&q=CharToOemBuffA+site%3Amicrosoft.com) | user32.dll | |
[CharToOem](https://www.google.com/search?num=5&q=CharToOemA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.CharToOem
[CharToOemBuff](https://www.google.com/search?num=5&q=CharToOemBuffA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.CharToOemBuff
[CheckDlgButton](http://msdn2.microsoft.com/en-us/library/checkdlgbutton) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.CheckDlgButton
[CheckMenuItem](http://msdn2.microsoft.com/en-us/library/checkmenuitem.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.CheckMenuItem
[CheckMenuRadioItem](http://msdn2.microsoft.com/en-us/library/checkmenuradioitem.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.CheckMenuRadioItem
@ -72,7 +70,6 @@ Native Method | Native DLL | Header | Managed Method
[CreateWindowEx](http://msdn2.microsoft.com/en-us/library/createwindowex) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.CreateWindowEx
[CreateWindowStation](http://msdn2.microsoft.com/en-us/library/c1aee546-decd-46c9-8d02-d6792f5a6a0d) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.CreateWindowStation
[DefDlgProc](http://msdn2.microsoft.com/en-us/library/defdlgproc) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DefDlgProc
[DefDlgProc](https://www.google.com/search?num=5&q=DefDlgProcA+site%3Amicrosoft.com) | user32.dll | |
[DeferWindowPos](http://msdn2.microsoft.com/en-us/library/deferwindowpos) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DeferWindowPos
[DefFrameProc](https://www.google.com/search?num=5&q=DefFrameProcA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DefFrameProc
[DefMDIChildProc](https://www.google.com/search?num=5&q=DefMDIChildProcA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DefMDIChildProc
@ -88,12 +85,11 @@ Native Method | Native DLL | Header | Managed Method
[DestroyWindow](http://msdn2.microsoft.com/en-us/library/destroywindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DestroyWindow
[DialogBoxIndirectParam](http://msdn2.microsoft.com/en-us/library/dialogboxindirectparam) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DialogBoxIndirectParam
[DialogBoxParam](http://msdn2.microsoft.com/en-us/library/dialogboxparam) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DialogBoxParam
[DisableProcessWindowsGhosting](https://www.google.com/search?num=5&q=DisableProcessWindowsGhosting+site%3Amicrosoft.com) | user32.dll | |
[DisableProcessWindowsGhosting](https://www.google.com/search?num=5&q=DisableProcessWindowsGhosting+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DisableProcessWindowsGhosting
[DispatchMessage](https://www.google.com/search?num=5&q=DispatchMessageA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DispatchMessage
[DisplayConfigGetDeviceInfo](http://msdn2.microsoft.com/en-us/library/249dcb1a-4ce3-4478-8331-fb81e91313b0) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DisplayConfigGetDeviceInfo
[DisplayConfigSetDeviceInfo](http://msdn2.microsoft.com/en-us/library/4050b1f0-a588-427c-a0df-eefdc488fc20) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DisplayConfigSetDeviceInfo
[DlgDirSelectComboBoxEx](https://www.google.com/search?num=5&q=DlgDirSelectComboBoxExA+site%3Amicrosoft.com) | user32.dll | |
[DlgDirSelectEx](https://www.google.com/search?num=5&q=DlgDirSelectExA+site%3Amicrosoft.com) | user32.dll | |
[DlgDirSelectComboBoxEx](https://www.google.com/search?num=5&q=DlgDirSelectComboBoxExA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DlgDirSelectComboBoxEx
[DragDetect](https://www.google.com/search?num=5&q=DragDetect+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DragDetect
[DrawAnimatedRects](http://msdn2.microsoft.com/en-us/library/54a9234a-0056-4cfe-9158-86635dc31bc6) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DrawAnimatedRects
[DrawCaption](http://msdn2.microsoft.com/en-us/library/9348e29f-ce56-4664-8862-f5810c797622) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DrawCaption
@ -105,13 +101,12 @@ Native Method | Native DLL | Header | Managed Method
[DrawMenuBar](http://msdn2.microsoft.com/en-us/library/drawmenubar.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DrawMenuBar
[DrawState](http://msdn2.microsoft.com/en-us/library/b92150be-8264-4ea8-a2ea-d70b7fba6361) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DrawState
[DrawText](http://msdn2.microsoft.com/en-us/library/dd162498) | user32.dll | WinUser.h | Vanara.PInvoke.User32_Gdi.DrawText
[DrawTextEx](https://www.google.com/search?num=5&q=DrawTextExA+site%3Amicrosoft.com) | user32.dll | |
[DrawTextEx](http://msdn2.microsoft.com/en-us/library/77b9973b-77f1-4508-a021-52d61d576c23) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.DrawTextEx
[EmptyClipboard](http://msdn2.microsoft.com/en-us/library/emptyclipboard) | user32.dll | winuser.h | Vanara.PInvoke.User32.EmptyClipboard
[EnableMenuItem](http://msdn2.microsoft.com/en-us/library/enablemenuitem.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.EnableMenuItem
[EnableMouseInPointer](http://msdn2.microsoft.com/en-us/library/66D9BF17-164F-455F-803F-36CDF88C34FF) | user32.dll | winuser.h | Vanara.PInvoke.User32.EnableMouseInPointer
[EnableNonClientDpiScaling](http://msdn2.microsoft.com/en-us/library/3459B040-B73F-4581-BA29-0B2F0241801E) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.EnableNonClientDpiScaling
[EnableOneCoreTransformMode](https://www.google.com/search?num=5&q=EnableOneCoreTransformMode+site%3Amicrosoft.com) | user32.dll | |
[EnableScrollBar](https://www.google.com/search?num=5&q=EnableScrollBar+site%3Amicrosoft.com) | user32.dll | |
[EnableScrollBar](https://www.google.com/search?num=5&q=EnableScrollBar+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.EnableScrollBar
[EnableWindow](https://www.google.com/search?num=5&q=EnableWindow+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.EnableWindow
[EndDeferWindowPos](http://msdn2.microsoft.com/en-us/library/enddeferwindowpos) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.EndDeferWindowPos
[EndDialog](http://msdn2.microsoft.com/en-us/library/enddialog) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.EndDialog
@ -133,33 +128,32 @@ Native Method | Native DLL | Header | Managed Method
[EnumWindows](http://msdn2.microsoft.com/en-us/library/enumwindows) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.EnumWindows
[EnumWindowStations](http://msdn2.microsoft.com/en-us/library/418d4d6a-9e4d-4fe3-8e1b-398c732c6e23) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.EnumWindowStations
[EqualRect](http://msdn2.microsoft.com/en-us/library/00763184-6b60-4095-b71e-5a851c2643aa) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.EqualRect
[EvaluateProximityToPolygon](https://www.google.com/search?num=5&q=EvaluateProximityToPolygon+site%3Amicrosoft.com) | user32.dll | |
[EvaluateProximityToRect](https://www.google.com/search?num=5&q=EvaluateProximityToRect+site%3Amicrosoft.com) | user32.dll | |
[EvaluateProximityToPolygon](http://msdn2.microsoft.com/en-us/library/443d12f2-9f26-4e1e-9bf3-cd97b4026399) | user32.dll | winuser.h | Vanara.PInvoke.User32.EvaluateProximityToPolygon
[EvaluateProximityToRect](http://msdn2.microsoft.com/en-us/library/269ef4c1-9c9f-4bd7-9852-e82c4a707d3c) | user32.dll | winuser.h | Vanara.PInvoke.User32.EvaluateProximityToRect
[ExcludeUpdateRgn](http://msdn2.microsoft.com/en-us/library/408fda82-30c3-4eb4-be42-3085c71ba99e) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ExcludeUpdateRgn
[ExitWindowsEx](http://msdn2.microsoft.com/en-us/library/aa376868) | user32.dll | Winuser.h | Vanara.PInvoke.User32.ExitWindowsEx
[FillRect](http://msdn2.microsoft.com/en-us/library/98ab34da-ea07-4446-a62e-509c849d95f9) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.FillRect
[FindWindow](http://msdn2.microsoft.com/en-us/library/findwindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.FindWindow
[FindWindowEx](http://msdn2.microsoft.com/en-us/library/findwindowex) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.FindWindowEx
[FlashWindow](https://www.google.com/search?num=5&q=FlashWindow+site%3Amicrosoft.com) | user32.dll | |
[FlashWindowEx](https://www.google.com/search?num=5&q=FlashWindowEx+site%3Amicrosoft.com) | user32.dll | |
[FlashWindow](http://msdn2.microsoft.com/en-us/library/c4af997d-5cb8-4d5d-ae8d-1e0cc724fe02) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.FlashWindow
[FlashWindowEx](http://msdn2.microsoft.com/en-us/library/474ec2d9-3ee9-4622-843e-d6ae36fedd7f) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.FlashWindowEx
[FrameRect](http://msdn2.microsoft.com/en-us/library/a1083cb5-5e6c-4134-badf-9fc5142d1453) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.FrameRect
[FreeDDElParam](https://www.google.com/search?num=5&q=FreeDDElParam+site%3Amicrosoft.com) | user32.dll | |
[FreeDDElParam](https://www.google.com/search?num=5&q=FreeDDElParam+site%3Amicrosoft.com) | user32.dll | dde.h | Vanara.PInvoke.User32_Gdi.FreeDDElParam
[GetActiveWindow](http://msdn2.microsoft.com/en-us/library/getactivewindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetActiveWindow
[GetAltTabInfo](https://www.google.com/search?num=5&q=GetAltTabInfo+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetAltTabInfo
[GetAncestor](http://msdn2.microsoft.com/en-us/library/getancestor) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetAncestor
[GetAsyncKeyState](https://www.google.com/search?num=5&q=GetAsyncKeyState+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetAsyncKeyState
[GetAutoRotationState](https://www.google.com/search?num=5&q=GetAutoRotationState+site%3Amicrosoft.com) | user32.dll | |
[GetAutoRotationState](http://msdn2.microsoft.com/en-us/library/E041717B-920E-44F8-AC7F-B30CB82F1476) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetAutoRotationState
[GetAwarenessFromDpiAwarenessContext](http://msdn2.microsoft.com/en-us/library/BE4DC6B9-BCD6-4E27-81F8-E3CF054CFBE9) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetAwarenessFromDpiAwarenessContext
[GetCapture](https://www.google.com/search?num=5&q=GetCapture+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetCapture
[GetCaretBlinkTime](https://www.google.com/search?num=5&q=GetCaretBlinkTime+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetCaretBlinkTime
[GetCaretPos](https://www.google.com/search?num=5&q=GetCaretPos+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetCaretPos
[GetCIMSSM](https://www.google.com/search?num=5&q=GetCIMSSM+site%3Amicrosoft.com) | user32.dll | |
[GetClassInfo](https://www.google.com/search?num=5&q=GetClassInfoA+site%3Amicrosoft.com) | user32.dll | |
[GetClassInfoEx](https://www.google.com/search?num=5&q=GetClassInfoExA+site%3Amicrosoft.com) | user32.dll | |
[GetClassLong](https://www.google.com/search?num=5&q=GetClassLongA+site%3Amicrosoft.com) | user32.dll | |
[GetClassLongPtr](https://www.google.com/search?num=5&q=GetClassLongPtrA+site%3Amicrosoft.com) | user32.dll | |
[GetClassName](https://www.google.com/search?num=5&q=GetClassNameA+site%3Amicrosoft.com) | user32.dll | |
[GetClassWord](https://www.google.com/search?num=5&q=GetClassWord+site%3Amicrosoft.com) | user32.dll | |
[GetClassInfo](https://www.google.com/search?num=5&q=GetClassInfoA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetClassInfo
[GetClassInfoEx](https://www.google.com/search?num=5&q=GetClassInfoExA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetClassInfoEx
[GetClassLong](https://www.google.com/search?num=5&q=GetClassLong+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetClassLong32
[GetClassLongPtr](https://www.google.com/search?num=5&q=GetClassLongPtrA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetClassLongPtr
[GetClassName](https://www.google.com/search?num=5&q=GetClassNameA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetClassName
[GetClassWord](https://www.google.com/search?num=5&q=GetClassWord+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetClassWord
[GetClientRect](http://msdn2.microsoft.com/en-us/library/ms633503) | user32.dll | WinUser.h | Vanara.PInvoke.User32_Gdi.GetClientRect
[GetClipboardData](http://msdn2.microsoft.com/en-us/library/getclipboarddata) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetClipboardData
[GetClipboardFormatNameA](http://msdn2.microsoft.com/en-us/library/getclipboardformatname) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetClipboardFormatName
@ -168,8 +162,7 @@ Native Method | Native DLL | Header | Managed Method
[GetClipboardSequenceNumber](http://msdn2.microsoft.com/en-us/library/getclipboardsequencenumber) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetClipboardSequenceNumber
[GetClipboardViewer](http://msdn2.microsoft.com/en-us/library/getclipboardviewer) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetClipboardViewer
[GetClipCursor](http://msdn2.microsoft.com/en-us/library/getclipcursor) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetClipCursor
[GetComboBoxInfo](https://www.google.com/search?num=5&q=GetComboBoxInfo+site%3Amicrosoft.com) | user32.dll | |
[GetCurrentInputMessageSource](https://www.google.com/search?num=5&q=GetCurrentInputMessageSource+site%3Amicrosoft.com) | user32.dll | |
[GetCurrentInputMessageSource](http://msdn2.microsoft.com/en-us/library/35e4ebf5-df9d-4168-9996-355204c2ab93) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetCurrentInputMessageSource
[GetCursor](http://msdn2.microsoft.com/en-us/library/getcursor) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetCursor
[GetCursorInfo](http://msdn2.microsoft.com/en-us/library/getcursorinfo) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetCursorInfo
[GetCursorPos](http://msdn2.microsoft.com/en-us/library/getcursorpos) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetCursorPos
@ -194,7 +187,7 @@ Native Method | Native DLL | Header | Managed Method
[GetGestureConfig](http://msdn2.microsoft.com/en-us/library/8b7a594c-e9e4-4215-8946-da170c957a2b) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetGestureConfig
[GetGestureExtraArgs](http://msdn2.microsoft.com/en-us/library/f7775d88-6a5b-4283-ab40-65c2da218f81) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetGestureExtraArgs
[GetGestureInfo](http://msdn2.microsoft.com/en-us/library/407ed585-09aa-4174-8907-8bb9590f1795) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetGestureInfo
[GetGuiResources](https://www.google.com/search?num=5&q=GetGuiResources+site%3Amicrosoft.com) | user32.dll | |
[GetGuiResources](http://msdn2.microsoft.com/en-us/library/55fbb7e8-79b4-4011-b522-25ea5a928b86) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetGuiResources
[GetGUIThreadInfo](http://msdn2.microsoft.com/en-us/library/getguithreadinfo) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetGUIThreadInfo
[GetIconInfo](http://msdn2.microsoft.com/en-us/library/geticoninfo) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetIconInfo
[GetIconInfoEx](http://msdn2.microsoft.com/en-us/library/geticoninfoex) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetIconInfoEx
@ -210,12 +203,10 @@ Native Method | Native DLL | Header | Managed Method
[GetLastActivePopup](http://msdn2.microsoft.com/en-us/library/getlastactivepopup) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetLastActivePopup
[GetLastInputInfo](https://www.google.com/search?num=5&q=GetLastInputInfo+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetLastInputInfo
[GetLayeredWindowAttributes](http://msdn2.microsoft.com/en-us/library/getlayeredwindowattributes) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetLayeredWindowAttributes
[GetListBoxInfo](https://www.google.com/search?num=5&q=GetListBoxInfo+site%3Amicrosoft.com) | user32.dll | |
[GetMagnificationDesktopSamplingMode](https://www.google.com/search?num=5&q=GetMagnificationDesktopSamplingMode+site%3Amicrosoft.com) | user32.dll | |
[GetMenu](http://msdn2.microsoft.com/en-us/library/getmenu.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetMenu
[GetMenuBarInfo](http://msdn2.microsoft.com/en-us/library/getmenubarinfo.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetMenuBarInfo
[GetMenuCheckMarkDimensions](http://msdn2.microsoft.com/en-us/library/getmenucheckmarkdimensions.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetMenuCheckMarkDimensions
[GetMenuContextHelpId](https://www.google.com/search?num=5&q=GetMenuContextHelpId+site%3Amicrosoft.com) | user32.dll | |
[GetMenuContextHelpId](http://msdn2.microsoft.com/en-us/library/2b8d3e94-6860-4a75-8373-38afb641eb3b) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetMenuContextHelpId
[GetMenuDefaultItem](http://msdn2.microsoft.com/en-us/library/getmenudefaultitem.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetMenuDefaultItem
[GetMenuInfo](http://msdn2.microsoft.com/en-us/library/getmenuinfo.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetMenuInfo
[GetMenuItemCount](http://msdn2.microsoft.com/en-us/library/getmenuitemcount.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetMenuItemCount
@ -237,11 +228,11 @@ Native Method | Native DLL | Header | Managed Method
[GetParent](http://msdn2.microsoft.com/en-us/library/getparent) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetParent
[GetPhysicalCursorPos](http://msdn2.microsoft.com/en-us/library/getphysicalcursorpos) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetPhysicalCursorPos
[GetPointerCursorId](http://msdn2.microsoft.com/en-us/library/43211600-ee82-416f-860f-423c581eda75) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetPointerCursorId
[GetPointerDevice](https://www.google.com/search?num=5&q=GetPointerDevice+site%3Amicrosoft.com) | user32.dll | |
[GetPointerDeviceCursors](https://www.google.com/search?num=5&q=GetPointerDeviceCursors+site%3Amicrosoft.com) | user32.dll | |
[GetPointerDeviceProperties](https://www.google.com/search?num=5&q=GetPointerDeviceProperties+site%3Amicrosoft.com) | user32.dll | |
[GetPointerDeviceRects](https://www.google.com/search?num=5&q=GetPointerDeviceRects+site%3Amicrosoft.com) | user32.dll | |
[GetPointerDevices](https://www.google.com/search?num=5&q=GetPointerDevices+site%3Amicrosoft.com) | user32.dll | |
[GetPointerDevice](http://msdn2.microsoft.com/en-us/library/800E0BFE-6E57-4EAA-B47C-FEEC0B5BFA2F) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetPointerDevice
[GetPointerDeviceCursors](http://msdn2.microsoft.com/en-us/library/4dd25033-e63a-4fa9-89b9-bfcae4061a76) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetPointerDeviceCursors
[GetPointerDeviceProperties](http://msdn2.microsoft.com/en-us/library/dbb81637-217a-49b1-9e81-2068cf4c0951) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetPointerDeviceProperties
[GetPointerDeviceRects](http://msdn2.microsoft.com/en-us/library/a6586dec-6d57-4345-be56-89c7308c1097) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetPointerDeviceRects
[GetPointerDevices](http://msdn2.microsoft.com/en-us/library/91FD5EBA-EDD7-4D7D-ABF3-3CE2461417B0) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetPointerDevices
[GetPointerFrameInfo](http://msdn2.microsoft.com/en-us/library/6b7f450d-6ab1-4991-b2f9-a1db3f065711) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetPointerFrameInfo
[GetPointerFrameInfoHistory](http://msdn2.microsoft.com/en-us/library/1ae035d6-a375-4421-82a6-50be4a2341f6) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetPointerFrameInfoHistory
[GetPointerFramePenInfo](http://msdn2.microsoft.com/en-us/library/52db9b96-7f9e-41d7-88f7-b9c7691a6511) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetPointerFramePenInfo
@ -265,12 +256,12 @@ Native Method | Native DLL | Header | Managed Method
[GetRawInputData](https://www.google.com/search?num=5&q=GetRawInputData+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetRawInputData
[GetRawInputDeviceInfo](https://www.google.com/search?num=5&q=GetRawInputDeviceInfoA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetRawInputDeviceInfo
[GetRawInputDeviceList](https://www.google.com/search?num=5&q=GetRawInputDeviceList+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetRawInputDeviceList
[GetRawPointerDeviceData](https://www.google.com/search?num=5&q=GetRawPointerDeviceData+site%3Amicrosoft.com) | user32.dll | |
[GetRawPointerDeviceData](http://msdn2.microsoft.com/en-us/library/56b65cc9-9582-4c7f-81e8-0b0d45b4dc8b) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetRawPointerDeviceData
[GetRegisteredRawInputDevices](https://www.google.com/search?num=5&q=GetRegisteredRawInputDevices+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.GetRegisteredRawInputDevices
[GetScrollBarInfo](https://www.google.com/search?num=5&q=GetScrollBarInfo+site%3Amicrosoft.com) | user32.dll | |
[GetScrollInfo](https://www.google.com/search?num=5&q=GetScrollInfo+site%3Amicrosoft.com) | user32.dll | |
[GetScrollPos](https://www.google.com/search?num=5&q=GetScrollPos+site%3Amicrosoft.com) | user32.dll | |
[GetScrollRange](https://www.google.com/search?num=5&q=GetScrollRange+site%3Amicrosoft.com) | user32.dll | |
[GetScrollBarInfo](https://www.google.com/search?num=5&q=GetScrollBarInfo+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetScrollBarInfo
[GetScrollInfo](https://www.google.com/search?num=5&q=GetScrollInfo+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetScrollInfo
[GetScrollPos](https://www.google.com/search?num=5&q=GetScrollPos+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetScrollPos
[GetScrollRange](https://www.google.com/search?num=5&q=GetScrollRange+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetScrollRange
[GetShellWindow](http://msdn2.microsoft.com/en-us/library/getshellwindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetShellWindow
[GetSubMenu](http://msdn2.microsoft.com/en-us/library/getsubmenu.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetSubMenu
[GetSysColor](http://msdn2.microsoft.com/en-us/library/ms724371) | user32.dll | WinUser.h | Vanara.PInvoke.User32_Gdi.GetSysColor
@ -292,20 +283,19 @@ Native Method | Native DLL | Header | Managed Method
[GetUpdateRgn](http://msdn2.microsoft.com/en-us/library/d80c4b44-3f50-46f9-bf5a-fff7868d91ba) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetUpdateRgn
[GetUserObjectInformationA](http://msdn2.microsoft.com/en-us/library/64f7361d-1a94-4d5b-86f1-a2a21737668a) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetUserObjectInformation
[GetUserObjectInformationW](http://msdn2.microsoft.com/en-us/library/64f7361d-1a94-4d5b-86f1-a2a21737668a) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetUserObjectInformation
[GetUserObjectSecurity](https://www.google.com/search?num=5&q=GetUserObjectSecurity+site%3Amicrosoft.com) | user32.dll | |
[GetUserObjectSecurity](http://msdn2.microsoft.com/en-us/library/998c2520-7833-4efd-a794-b13b528f0485) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetUserObjectSecurity
[GetWindow](http://msdn2.microsoft.com/en-us/library/getwindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindow
[GetWindowContextHelpId](https://www.google.com/search?num=5&q=GetWindowContextHelpId+site%3Amicrosoft.com) | user32.dll | |
[GetWindowContextHelpId](http://msdn2.microsoft.com/en-us/library/28e57c01-0327-4f64-9ef4-ca13c3c32b0c) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowContextHelpId
[GetWindowDC](http://msdn2.microsoft.com/en-us/library/9e6a135e-e337-4129-a3ad-faf9a8ac9b2d) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowDC
[GetWindowDisplayAffinity](http://msdn2.microsoft.com/en-us/library/getwindowdisplayaffinity) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowDisplayAffinity
[GetWindowDpiAwarenessContext](http://msdn2.microsoft.com/en-us/library/BCBC6EC7-9792-43C0-BE0E-D94F00A7CAFD) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowDpiAwarenessContext
[GetWindowDpiHostingBehavior](http://msdn2.microsoft.com/en-us/library/BD16F545-54A1-479A-BA4B-F54834043EB2) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowDpiHostingBehavior
[GetWindowFeedbackSetting](https://www.google.com/search?num=5&q=GetWindowFeedbackSetting+site%3Amicrosoft.com) | user32.dll | |
[GetWindowFeedbackSetting](http://msdn2.microsoft.com/en-us/library/a40806b3-9085-42b6-9a87-95be0d1669c6) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowFeedbackSetting
[GetWindowInfo](http://msdn2.microsoft.com/en-us/library/getwindowinfo) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowInfo
[GetWindowLong](https://www.google.com/search?num=5&q=GetWindowLongA+site%3Amicrosoft.com) | user32.dll | | Vanara.PInvoke.User32_Gdi.GetWindowLong
[GetWindowLongPtr](https://www.google.com/search?num=5&q=GetWindowLongPtrA+site%3Amicrosoft.com) | user32.dll | | Vanara.PInvoke.User32_Gdi.GetWindowLongPtr
[GetWindowModuleFileName](https://www.google.com/search?num=5&q=GetWindowModuleFileName+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowModuleFileName
[GetWindowPlacement](http://msdn2.microsoft.com/en-us/library/getwindowplacement) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowPlacement
[GetWindowProcessHandle](https://www.google.com/search?num=5&q=GetWindowProcessHandle+site%3Amicrosoft.com) | user32.dll | |
[GetWindowRect](http://msdn2.microsoft.com/en-us/library/ms633519) | user32.dll | WinUser.h | Vanara.PInvoke.User32_Gdi.GetWindowRect
[GetWindowRgn](http://msdn2.microsoft.com/en-us/library/c8a8fa46-354b-489e-b016-fd2e728958ce) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowRgn
[GetWindowRgnBox](http://msdn2.microsoft.com/en-us/library/20e23474-a1c5-4afe-976e-a7e5790fb91b) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GetWindowRgnBox
@ -315,10 +305,10 @@ Native Method | Native DLL | Header | Managed Method
[GrayString](http://msdn2.microsoft.com/en-us/library/b14b8c40-f97f-4e41-8d8d-687692acfda9) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.GrayString
[HideCaret](https://www.google.com/search?num=5&q=HideCaret+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.HideCaret
[HiliteMenuItem](http://msdn2.microsoft.com/en-us/library/hilitemenuitem.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.HiliteMenuItem
[ImpersonateDdeClientWindow](https://www.google.com/search?num=5&q=ImpersonateDdeClientWindow+site%3Amicrosoft.com) | user32.dll | |
[ImpersonateDdeClientWindow](https://www.google.com/search?num=5&q=ImpersonateDdeClientWindow+site%3Amicrosoft.com) | user32.dll | dde.h | Vanara.PInvoke.User32_Gdi.ImpersonateDdeClientWindow
[InflateRect](http://msdn2.microsoft.com/en-us/library/9a52fb7f-cd35-4426-8753-c26cebef30d5) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.InflateRect
[InitializeTouchInjection](https://www.google.com/search?num=5&q=InitializeTouchInjection+site%3Amicrosoft.com) | user32.dll | |
[InjectTouchInput](https://www.google.com/search?num=5&q=InjectTouchInput+site%3Amicrosoft.com) | user32.dll | |
[InitializeTouchInjection](http://msdn2.microsoft.com/en-us/library/79cc2a05-d8ee-4d87-9c7b-fa7d5354b04f) | user32.dll | winuser.h | Vanara.PInvoke.User32.InitializeTouchInjection
[InjectTouchInput](http://msdn2.microsoft.com/en-us/library/c3c1425e-2af6-4ecb-a0b2-a456654f7a53) | user32.dll | winuser.h | Vanara.PInvoke.User32.InjectTouchInput
[InSendMessage](https://www.google.com/search?num=5&q=InSendMessage+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.InSendMessage
[InSendMessageEx](https://www.google.com/search?num=5&q=InSendMessageEx+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.InSendMessageEx
[InsertMenu](http://msdn2.microsoft.com/en-us/library/insertmenu.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.InsertMenu
@ -327,7 +317,7 @@ Native Method | Native DLL | Header | Managed Method
[IntersectRect](http://msdn2.microsoft.com/en-us/library/da686f78-e557-4ff2-9f24-b229f0c01563) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IntersectRect
[InvalidateRect](http://msdn2.microsoft.com/en-us/library/5a823d36-d08b-41c9-8857-540576f54b55) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.InvalidateRect
[InvalidateRgn](http://msdn2.microsoft.com/en-us/library/b5b44efe-8045-4e54-89f9-1766689a053d) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.InvalidateRgn
[InvertRect](https://www.google.com/search?num=5&q=InvertRect+site%3Amicrosoft.com) | user32.dll | |
[InvertRect](http://msdn2.microsoft.com/en-us/library/a8c4dbf1-94ec-46e9-b365-7dfc89e4f176) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.InvertRect
[IsChild](http://msdn2.microsoft.com/en-us/library/ischild) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsChild
[IsClipboardFormatAvailable](http://msdn2.microsoft.com/en-us/library/isclipboardformatavailable) | user32.dll | winuser.h | Vanara.PInvoke.User32.IsClipboardFormatAvailable
[IsDialogMessage](https://www.google.com/search?num=5&q=IsDialogMessage+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsDialogMessage
@ -335,22 +325,20 @@ Native Method | Native DLL | Header | Managed Method
[IsGUIThread](http://msdn2.microsoft.com/en-us/library/isguithread) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsGUIThread
[IsHungAppWindow](http://msdn2.microsoft.com/en-us/library/ishungappwindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsHungAppWindow
[IsIconic](http://msdn2.microsoft.com/en-us/library/isiconic) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsIconic
[IsImmersiveProcess](https://www.google.com/search?num=5&q=IsImmersiveProcess+site%3Amicrosoft.com) | user32.dll | |
[IsImmersiveProcess](http://msdn2.microsoft.com/en-us/library/E95FD9C0-8E4A-44FA-BBA6-0A7F53A0E584) | user32.dll | winuser.h | Vanara.PInvoke.User32.IsImmersiveProcess
[IsMenu](http://msdn2.microsoft.com/en-us/library/ismenu.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsMenu
[IsMouseInPointerEnabled](http://msdn2.microsoft.com/en-us/library/5D493066-2425-4610-8489-575BF25C8C16) | user32.dll | winuser.h | Vanara.PInvoke.User32.IsMouseInPointerEnabled
[IsOneCoreTransformMode](https://www.google.com/search?num=5&q=IsOneCoreTransformMode+site%3Amicrosoft.com) | user32.dll | |
[IsProcessDPIAware](http://msdn2.microsoft.com/en-us/library/isprocessdpiaware) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsProcessDPIAware
[IsRectEmpty](http://msdn2.microsoft.com/en-us/library/9deeed4f-304e-47a3-8259-ed7bc3815fd7) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsRectEmpty
[IsThreadTSFEventAware](https://www.google.com/search?num=5&q=IsThreadTSFEventAware+site%3Amicrosoft.com) | user32.dll | |
[IsTouchWindow](http://msdn2.microsoft.com/en-us/library/080b9d18-5975-4d38-ae3b-151f74120bb3) | user32.dll | winuser.h | Vanara.PInvoke.User32.IsTouchWindow
[IsValidDpiAwarenessContext](http://msdn2.microsoft.com/en-us/library/66F48B95-DEF4-4422-BF4F-5EBA3C713A80) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsValidDpiAwarenessContext
[IsWindow](http://msdn2.microsoft.com/en-us/library/iswindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsWindow
[IsWindowEnabled](https://www.google.com/search?num=5&q=IsWindowEnabled+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsWindowEnabled
[IsWindowRedirectedForPrint](https://www.google.com/search?num=5&q=IsWindowRedirectedForPrint+site%3Amicrosoft.com) | user32.dll | |
[IsWindowRedirectedForPrint](http://msdn2.microsoft.com/en-us/library/49FD0D63-0F7F-48C6-81B6-25715294E7B7) | user32.dll | | Vanara.PInvoke.User32_Gdi.IsWindowRedirectedForPrint
[IsWindowUnicode](http://msdn2.microsoft.com/en-us/library/iswindowunicode) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsWindowUnicode
[IsWindowVisible](http://msdn2.microsoft.com/en-us/library/iswindowvisible) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsWindowVisible
[IsWinEventHookInstalled](https://www.google.com/search?num=5&q=IsWinEventHookInstalled+site%3Amicrosoft.com) | user32.dll | |
[IsWow64Message](https://www.google.com/search?num=5&q=IsWow64Message+site%3Amicrosoft.com) | user32.dll | |
[IsWinEventHookInstalled](http://msdn2.microsoft.com/en-us/library/bc1e97ad-748d-420a-8c9a-72a555b685e1) | user32.dll | winuser.h | Vanara.PInvoke.User32.IsWinEventHookInstalled
[IsWow64Message](http://msdn2.microsoft.com/en-us/library/bc0ac424-3c5b-41bf-9dae-bcb405d5b548) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsWow64Message
[IsZoomed](http://msdn2.microsoft.com/en-us/library/iszoomed) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.IsZoomed
[keybd_event](https://www.google.com/search?num=5&q=keybd_event+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.keybd_event
[KillTimer](https://www.google.com/search?num=5&q=KillTimer+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.KillTimer
@ -373,42 +361,35 @@ Native Method | Native DLL | Header | Managed Method
[LogicalToPhysicalPointForPerMonitorDPI](http://msdn2.microsoft.com/en-us/library/C9ABDC73-1E96-42F1-B34D-3A649DDF02A6) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.LogicalToPhysicalPointForPerMonitorDPI
[LookupIconIdFromDirectory](http://msdn2.microsoft.com/en-us/library/lookupiconidfromdirectory) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.LookupIconIdFromDirectory
[LookupIconIdFromDirectoryEx](http://msdn2.microsoft.com/en-us/library/lookupiconidfromdirectoryex) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.LookupIconIdFromDirectoryEx
[MakeThreadTSFEventAware](https://www.google.com/search?num=5&q=MakeThreadTSFEventAware+site%3Amicrosoft.com) | user32.dll | |
[MapDialogRect](http://msdn2.microsoft.com/en-us/library/mapdialogrect) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.MapDialogRect
[MapVirtualKey](https://www.google.com/search?num=5&q=MapVirtualKeyA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.MapVirtualKey
[MapVirtualKeyEx](https://www.google.com/search?num=5&q=MapVirtualKeyExA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.MapVirtualKeyEx
[MapVisualRelativePoints](https://www.google.com/search?num=5&q=MapVisualRelativePoints+site%3Amicrosoft.com) | user32.dll | |
[MapWindowPoints](https://www.google.com/search?num=5&q=MapWindowPoints+site%3Amicrosoft.com) | user32.dll | WinUser.h | Vanara.PInvoke.User32_Gdi.MapWindowPoints
[MB_GetString](https://www.google.com/search?num=5&q=MB_GetString+site%3Amicrosoft.com) | user32.dll | |
[MB_GetString](http://msdn2.microsoft.com/en-us/library/D2AF238D-F5A8-477D-BF47-0F5D4D68B27E) | user32.dll | | Vanara.PInvoke.User32.MB_GetString
[MenuItemFromPoint](http://msdn2.microsoft.com/en-us/library/menuitemfrompoint.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.MenuItemFromPoint
[MessageBeep](http://msdn2.microsoft.com/en-us/library/70681472-36a5-4ae3-b769-0421cf97ff2a) | user32.dll | winuser.h | Vanara.PInvoke.User32.MessageBeep
[MessageBox](http://msdn2.microsoft.com/en-us/library/messagebox) | user32.dll | winuser.h | Vanara.PInvoke.User32.MessageBox
[MessageBoxIndirect](https://www.google.com/search?num=5&q=MessageBoxIndirectA+site%3Amicrosoft.com) | user32.dll | Winuser.h | Vanara.PInvoke.User32.MessageBoxIndirect
[MITDispatchCompletion](https://www.google.com/search?num=5&q=MITDispatchCompletion+site%3Amicrosoft.com) | user32.dll | |
[MITGetCursorUpdateHandle](https://www.google.com/search?num=5&q=MITGetCursorUpdateHandle+site%3Amicrosoft.com) | user32.dll | |
[MITSetInputDelegationMode](https://www.google.com/search?num=5&q=MITSetInputDelegationMode+site%3Amicrosoft.com) | user32.dll | |
[MITSetLastInputRecipient](https://www.google.com/search?num=5&q=MITSetLastInputRecipient+site%3Amicrosoft.com) | user32.dll | |
[MITStopAndEndInertia](https://www.google.com/search?num=5&q=MITStopAndEndInertia+site%3Amicrosoft.com) | user32.dll | |
[ModifyMenu](http://msdn2.microsoft.com/en-us/library/modifymenu.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ModifyMenu
[MonitorFromPoint](http://msdn2.microsoft.com/en-us/library/c46281bf-7e45-4628-be92-736850225a9e) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.MonitorFromPoint
[MonitorFromRect](http://msdn2.microsoft.com/en-us/library/81c3fffb-bbc9-4adb-bb6b-edd59f7a77b4) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.MonitorFromRect
[MonitorFromWindow](http://msdn2.microsoft.com/en-us/library/fe6505c9-b481-4fec-ae9d-995943234a3a) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.MonitorFromWindow
[mouse_event](https://www.google.com/search?num=5&q=mouse_event+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.mouse_event
[MoveWindow](http://msdn2.microsoft.com/en-us/library/movewindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.MoveWindow
[MsgWaitForMultipleObjects](https://www.google.com/search?num=5&q=MsgWaitForMultipleObjects+site%3Amicrosoft.com) | user32.dll | |
[MsgWaitForMultipleObjectsEx](https://www.google.com/search?num=5&q=MsgWaitForMultipleObjectsEx+site%3Amicrosoft.com) | user32.dll | |
[NotifyWinEvent](https://www.google.com/search?num=5&q=NotifyWinEvent+site%3Amicrosoft.com) | user32.dll | |
[MsgWaitForMultipleObjects](http://msdn2.microsoft.com/en-us/library/0629f1b3-6805-43a7-9aeb-4f80939ec62c) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.MsgWaitForMultipleObjects
[MsgWaitForMultipleObjectsEx](http://msdn2.microsoft.com/en-us/library/1774b721-3ad4-492e-96af-b71de9066f0c) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.MsgWaitForMultipleObjectsEx
[NotifyWinEvent](http://msdn2.microsoft.com/en-us/library/08e74d45-95b6-44c2-a2e0-5ba6ffdcd56a) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.NotifyWinEvent
[OemKeyScan](https://www.google.com/search?num=5&q=OemKeyScan+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.OemKeyScan
[OemToChar](https://www.google.com/search?num=5&q=OemToCharA+site%3Amicrosoft.com) | user32.dll | |
[OemToCharBuff](https://www.google.com/search?num=5&q=OemToCharBuffA+site%3Amicrosoft.com) | user32.dll | |
[OemToChar](https://www.google.com/search?num=5&q=OemToCharA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.OemToChar
[OemToCharBuff](https://www.google.com/search?num=5&q=OemToCharBuffA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.OemToCharBuff
[OffsetRect](http://msdn2.microsoft.com/en-us/library/14101ad3-8c6e-459a-974a-1a8a4d8d7906) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.OffsetRect
[OpenClipboard](http://msdn2.microsoft.com/en-us/library/openclipboard) | user32.dll | winuser.h | Vanara.PInvoke.User32.OpenClipboard
[OpenDesktop](http://msdn2.microsoft.com/en-us/library/7f805f47-1737-4f4b-a74a-9c1423b65f2c) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.OpenDesktop
[OpenIcon](http://msdn2.microsoft.com/en-us/library/openicon) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.OpenIcon
[OpenInputDesktop](http://msdn2.microsoft.com/en-us/library/023d421e-bf32-4e08-b5b3-b7b2ca6c4e00) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.OpenInputDesktop
[OpenWindowStation](http://msdn2.microsoft.com/en-us/library/78ee7100-1bad-4c2d-b923-c5e67191bd41) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.OpenWindowStation
[PackDDElParam](https://www.google.com/search?num=5&q=PackDDElParam+site%3Amicrosoft.com) | user32.dll | |
[PackTouchHitTestingProximityEvaluation](https://www.google.com/search?num=5&q=PackTouchHitTestingProximityEvaluation+site%3Amicrosoft.com) | user32.dll | |
[PackDDElParam](https://www.google.com/search?num=5&q=PackDDElParam+site%3Amicrosoft.com) | user32.dll | dde.h | Vanara.PInvoke.User32_Gdi.PackDDElParam
[PackTouchHitTestingProximityEvaluation](http://msdn2.microsoft.com/en-us/library/c4061285-2d0f-4404-9b63-bda2ec61b764) | user32.dll | winuser.h | Vanara.PInvoke.User32.PackTouchHitTestingProximityEvaluation
[PaintDesktop](http://msdn2.microsoft.com/en-us/library/738500d4-32f5-43cf-8d40-9ad201ca6d4b) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.PaintDesktop
[PeekMessage](https://www.google.com/search?num=5&q=PeekMessageA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.PeekMessage
[PhysicalToLogicalPoint](http://msdn2.microsoft.com/en-us/library/physicaltologicalpoint) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.PhysicalToLogicalPoint
@ -416,27 +397,26 @@ Native Method | Native DLL | Header | Managed Method
[PostMessage](https://www.google.com/search?num=5&q=PostMessageA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.PostMessage
[PostQuitMessage](https://www.google.com/search?num=5&q=PostQuitMessage+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.PostQuitMessage
[PostThreadMessage](https://www.google.com/search?num=5&q=PostThreadMessageA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.PostThreadMessage
[PrintWindow](https://www.google.com/search?num=5&q=PrintWindow+site%3Amicrosoft.com) | user32.dll | |
[PrintWindow](http://msdn2.microsoft.com/en-us/library/00b38cd8-1cfb-408e-88da-6e61563d9d8e) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.PrintWindow
[PrivateExtractIcons](http://msdn2.microsoft.com/en-us/library/privateextracticons) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.PrivateExtractIcons
[PtInRect](http://msdn2.microsoft.com/en-us/library/8a47a238-082c-44b8-a270-5ebb4d3d9fc8) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.PtInRect
[QueryDisplayConfig](http://msdn2.microsoft.com/en-us/library/b1792d7f-f216-4250-a6b6-a11b251a9cec) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.QueryDisplayConfig
[RealChildWindowFromPoint](http://msdn2.microsoft.com/en-us/library/realchildwindowfrompoint) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RealChildWindowFromPoint
[RealGetWindowClass](https://www.google.com/search?num=5&q=RealGetWindowClass+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RealGetWindowClass
[RedrawWindow](http://msdn2.microsoft.com/en-us/library/c6cb7f74-237e-4d3e-a852-894da36e990c) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RedrawWindow
[RegisterClass](https://www.google.com/search?num=5&q=RegisterClassA+site%3Amicrosoft.com) | user32.dll | |
[RegisterClassEx](https://www.google.com/search?num=5&q=RegisterClassExA+site%3Amicrosoft.com) | user32.dll | |
[RegisterClass](https://www.google.com/search?num=5&q=RegisterClassA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RegisterClass
[RegisterClassEx](https://www.google.com/search?num=5&q=RegisterClassExA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RegisterClassEx
[RegisterClipboardFormat](http://msdn2.microsoft.com/en-us/library/registerclipboardformat) | user32.dll | winuser.h | Vanara.PInvoke.User32.RegisterClipboardFormat
[RegisterDeviceNotification](http://msdn2.microsoft.com/en-us/library/82094d95-9af3-4222-9c5e-ce2df9bab5e3) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RegisterDeviceNotification
[RegisterHotKey](http://msdn2.microsoft.com/en-us/library/registerhotkey) | user32.dll | winuser.h | Vanara.PInvoke.User32.RegisterHotKey
[RegisterLogonProcess](https://www.google.com/search?num=5&q=RegisterLogonProcess+site%3Amicrosoft.com) | user32.dll | |
[RegisterPointerDeviceNotifications](https://www.google.com/search?num=5&q=RegisterPointerDeviceNotifications+site%3Amicrosoft.com) | user32.dll | |
[RegisterPointerInputTarget](https://www.google.com/search?num=5&q=RegisterPointerInputTarget+site%3Amicrosoft.com) | user32.dll | |
[RegisterPointerInputTargetEx](https://www.google.com/search?num=5&q=RegisterPointerInputTargetEx+site%3Amicrosoft.com) | user32.dll | |
[RegisterPowerSettingNotification](https://www.google.com/search?num=5&q=RegisterPowerSettingNotification+site%3Amicrosoft.com) | user32.dll | |
[RegisterPointerDeviceNotifications](http://msdn2.microsoft.com/en-us/library/a7322d97-f96c-449d-94a6-2081962ec7ed) | user32.dll | winuser.h | Vanara.PInvoke.User32.RegisterPointerDeviceNotifications
[RegisterPointerInputTarget](http://msdn2.microsoft.com/en-us/library/75faea24-91cd-448b-b67a-09fe530f1830) | user32.dll | winuser.h | Vanara.PInvoke.User32.RegisterPointerInputTarget
[RegisterPointerInputTargetEx](http://msdn2.microsoft.com/en-us/library/E2B3D097-36E5-4444-B9DF-B3D38F1FEF48) | user32.dll | winuser.h | Vanara.PInvoke.User32.RegisterPointerInputTargetEx
[RegisterPowerSettingNotification](http://msdn2.microsoft.com/en-us/library/e072222e-da66-4b36-a38f-f4b618eaa391) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RegisterPowerSettingNotification
[RegisterRawInputDevices](https://www.google.com/search?num=5&q=RegisterRawInputDevices+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.RegisterRawInputDevices
[RegisterShellHookWindow](http://msdn2.microsoft.com/en-us/library/registershellhookwindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RegisterShellHookWindow
[RegisterSuspendResumeNotification](https://www.google.com/search?num=5&q=RegisterSuspendResumeNotification+site%3Amicrosoft.com) | user32.dll | |
[RegisterTouchHitTestingWindow](https://www.google.com/search?num=5&q=RegisterTouchHitTestingWindow+site%3Amicrosoft.com) | user32.dll | |
[RegisterSuspendResumeNotification](http://msdn2.microsoft.com/en-us/library/6cd42d32-07e9-4cbd-83f9-6146b1cb54db) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RegisterSuspendResumeNotification
[RegisterTouchHitTestingWindow](http://msdn2.microsoft.com/en-us/library/52e48cea-b5c7-405f-8df6-26052304b62c) | user32.dll | winuser.h | Vanara.PInvoke.User32.RegisterTouchHitTestingWindow
[RegisterTouchWindow](http://msdn2.microsoft.com/en-us/library/a70a7418-f79d-40c8-9219-3ce38a74da9f) | user32.dll | winuser.h | Vanara.PInvoke.User32.RegisterTouchWindow
[RegisterWindowMessage](https://www.google.com/search?num=5&q=RegisterWindowMessageA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RegisterWindowMessage
[ReleaseCapture](https://www.google.com/search?num=5&q=ReleaseCapture+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ReleaseCapture
@ -444,17 +424,14 @@ Native Method | Native DLL | Header | Managed Method
[RemoveClipboardFormatListener](http://msdn2.microsoft.com/en-us/library/removeclipboardformatlistener) | user32.dll | winuser.h | Vanara.PInvoke.User32.RemoveClipboardFormatListener
[RemoveMenu](http://msdn2.microsoft.com/en-us/library/removemenu.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.RemoveMenu
[RemoveProp](http://msdn2.microsoft.com/en-us/library/removeprop) | user32.dll | winuser.h | Vanara.PInvoke.User32.RemoveProp
[RemoveThreadTSFEventAwareness](https://www.google.com/search?num=5&q=RemoveThreadTSFEventAwareness+site%3Amicrosoft.com) | user32.dll | |
[ReplyMessage](https://www.google.com/search?num=5&q=ReplyMessage+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ReplyMessage
[ReuseDDElParam](https://www.google.com/search?num=5&q=ReuseDDElParam+site%3Amicrosoft.com) | user32.dll | |
[RIMEnableMonitorMappingForDevice](https://www.google.com/search?num=5&q=RIMEnableMonitorMappingForDevice+site%3Amicrosoft.com) | user32.dll | |
[ReuseDDElParam](https://www.google.com/search?num=5&q=ReuseDDElParam+site%3Amicrosoft.com) | user32.dll | dde.h | Vanara.PInvoke.User32_Gdi.ReuseDDElParam
[ScreenToClient](https://www.google.com/search?num=5&q=ScreenToClient+site%3Amicrosoft.com) | user32.dll | | Vanara.PInvoke.User32_Gdi.ScreenToClient
[ScrollDC](https://www.google.com/search?num=5&q=ScrollDC+site%3Amicrosoft.com) | user32.dll | |
[ScrollWindow](https://www.google.com/search?num=5&q=ScrollWindow+site%3Amicrosoft.com) | user32.dll | |
[ScrollWindowEx](https://www.google.com/search?num=5&q=ScrollWindowEx+site%3Amicrosoft.com) | user32.dll | |
[ScrollDC](https://www.google.com/search?num=5&q=ScrollDC+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ScrollDC
[ScrollWindow](https://www.google.com/search?num=5&q=ScrollWindow+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ScrollWindow
[ScrollWindowEx](https://www.google.com/search?num=5&q=ScrollWindowEx+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ScrollWindowEx
[SendDlgItemMessage](http://msdn2.microsoft.com/en-us/library/senddlgitemmessage) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SendDlgItemMessage
[SendInput](https://www.google.com/search?num=5&q=SendInput+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.SendInput
[SendMessage](http://msdn2.microsoft.com/en-us/library/ms644950) | user32.dll | Winuser.h | Vanara.PInvoke.User32_Gdi.SendMessage
[SendMessage](http://msdn2.microsoft.com/en-us/library/ms644950) | user32.dll | Winuser.h | Vanara.PInvoke.User32_Gdi.SendMessageUnsafe
[SendMessageCallbackA](https://www.google.com/search?num=5&q=SendMessageCallbackA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SendMessageCallback
[SendMessageCallbackW](https://www.google.com/search?num=5&q=SendMessageCallbackW+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SendMessageCallback
@ -464,15 +441,14 @@ Native Method | Native DLL | Header | Managed Method
[SetCapture](https://www.google.com/search?num=5&q=SetCapture+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetCapture
[SetCaretBlinkTime](https://www.google.com/search?num=5&q=SetCaretBlinkTime+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetCaretBlinkTime
[SetCaretPos](https://www.google.com/search?num=5&q=SetCaretPos+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetCaretPos
[SetClassLong](https://www.google.com/search?num=5&q=SetClassLongA+site%3Amicrosoft.com) | user32.dll | |
[SetClassLongPtr](https://www.google.com/search?num=5&q=SetClassLongPtrA+site%3Amicrosoft.com) | user32.dll | |
[SetClassWord](https://www.google.com/search?num=5&q=SetClassWord+site%3Amicrosoft.com) | user32.dll | |
[SetClassLong](https://www.google.com/search?num=5&q=SetClassLong+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetClassLong32
[SetClassLongPtr](https://www.google.com/search?num=5&q=SetClassLongPtrA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetClassLongPtr
[SetClassWord](https://www.google.com/search?num=5&q=SetClassWord+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetClassWord
[SetClipboardData](http://msdn2.microsoft.com/en-us/library/setclipboarddata) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetClipboardData
[SetClipboardViewer](http://msdn2.microsoft.com/en-us/library/setclipboardviewer) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetClipboardViewer
[SetCoalescableTimer](https://www.google.com/search?num=5&q=SetCoalescableTimer+site%3Amicrosoft.com) | user32.dll | |
[SetCoalescableTimer](http://msdn2.microsoft.com/en-us/library/39303811-972f-4131-deea-cebf84c50867) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetCoalescableTimer
[SetCursor](http://msdn2.microsoft.com/en-us/library/setcursor) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetCursor
[SetCursorPos](http://msdn2.microsoft.com/en-us/library/setcursorpos) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetCursorPos
[SetDesktopColorTransform](https://www.google.com/search?num=5&q=SetDesktopColorTransform+site%3Amicrosoft.com) | user32.dll | |
[SetDialogControlDpiChangeBehavior](http://msdn2.microsoft.com/en-us/library/52BB557B-0D70-4189-9BD0-EB94188EA4E7) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetDialogControlDpiChangeBehavior
[SetDialogDpiChangeBehavior](http://msdn2.microsoft.com/en-us/library/48A13F57-9D82-4F79-962B-FBD02FFF9B39) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetDialogDpiChangeBehavior
[SetDisplayAutoRotationPreferences](https://www.google.com/search?num=5&q=SetDisplayAutoRotationPreferences+site%3Amicrosoft.com) | user32.dll | Winuser.h | Vanara.PInvoke.User32_Gdi.SetDisplayAutoRotationPreferences
@ -484,11 +460,10 @@ Native Method | Native DLL | Header | Managed Method
[SetForegroundWindow](http://msdn2.microsoft.com/en-us/library/setforegroundwindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetForegroundWindow
[SetGestureConfig](http://msdn2.microsoft.com/en-us/library/7df5a18e-5e65-4dd5-a59d-853a91ead710) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetGestureConfig
[SetKeyboardState](https://www.google.com/search?num=5&q=SetKeyboardState+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetKeyboardState
[SetLastErrorEx](https://www.google.com/search?num=5&q=SetLastErrorEx+site%3Amicrosoft.com) | user32.dll | |
[SetLastErrorEx](http://msdn2.microsoft.com/en-us/library/d97494db-868a-49d4-a613-e8beba86d4e6) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetLastErrorEx
[SetLayeredWindowAttributes](http://msdn2.microsoft.com/en-us/library/setlayeredwindowattributes) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetLayeredWindowAttributes
[SetMagnificationDesktopSamplingMode](https://www.google.com/search?num=5&q=SetMagnificationDesktopSamplingMode+site%3Amicrosoft.com) | user32.dll | |
[SetMenu](http://msdn2.microsoft.com/en-us/library/setmenu.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetMenu
[SetMenuContextHelpId](https://www.google.com/search?num=5&q=SetMenuContextHelpId+site%3Amicrosoft.com) | user32.dll | |
[SetMenuContextHelpId](http://msdn2.microsoft.com/en-us/library/55d944db-d889-468a-991a-b9779c90b44f) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetMenuContextHelpId
[SetMenuDefaultItem](http://msdn2.microsoft.com/en-us/library/setmenudefaultitem.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetMenuDefaultItem
[SetMenuInfo](http://msdn2.microsoft.com/en-us/library/setmenuinfo.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetMenuInfo
[SetMenuItemBitmaps](http://msdn2.microsoft.com/en-us/library/setmenuitembitmaps.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetMenuItemBitmaps
@ -499,14 +474,14 @@ Native Method | Native DLL | Header | Managed Method
[SetProcessDefaultLayout](http://msdn2.microsoft.com/en-us/library/setprocessdefaultlayout) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetProcessDefaultLayout
[SetProcessDPIAware](http://msdn2.microsoft.com/en-us/library/setprocessdpiaware) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetProcessDPIAware
[SetProcessDpiAwarenessContext](http://msdn2.microsoft.com/en-us/library/EACD1784-BEFF-46C1-8665-CBC86A65833C) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetProcessDpiAwarenessContext
[SetProcessRestrictionExemption](https://www.google.com/search?num=5&q=SetProcessRestrictionExemption+site%3Amicrosoft.com) | user32.dll | |
[SetProcessRestrictionExemption](http://msdn2.microsoft.com/en-us/library/CC7EE5D7-ADFC-4859-88F8-C5C21AEBF315) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetProcessRestrictionExemption
[SetProcessWindowStation](http://msdn2.microsoft.com/en-us/library/d64814a7-945c-4e73-a977-5f696d60610e) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetProcessWindowStation
[SetProp](http://msdn2.microsoft.com/en-us/library/setprop) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetProp
[SetRect](http://msdn2.microsoft.com/en-us/library/346c573b-eaf7-4ca6-bd36-18074f7eccf5) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetRect
[SetRectEmpty](http://msdn2.microsoft.com/en-us/library/d3c677ae-e45c-4d54-8521-75954a466a68) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetRectEmpty
[SetScrollInfo](https://www.google.com/search?num=5&q=SetScrollInfo+site%3Amicrosoft.com) | user32.dll | |
[SetScrollPos](https://www.google.com/search?num=5&q=SetScrollPos+site%3Amicrosoft.com) | user32.dll | |
[SetScrollRange](https://www.google.com/search?num=5&q=SetScrollRange+site%3Amicrosoft.com) | user32.dll | |
[SetScrollInfo](https://www.google.com/search?num=5&q=SetScrollInfo+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetScrollInfo
[SetScrollPos](https://www.google.com/search?num=5&q=SetScrollPos+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetScrollPos
[SetScrollRange](https://www.google.com/search?num=5&q=SetScrollRange+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetScrollRange
[SetSysColors](http://msdn2.microsoft.com/en-us/library/41a7a96c-f9d1-44e3-a7e1-fd7d155c4ed0) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetSysColors
[SetSystemCursor](http://msdn2.microsoft.com/en-us/library/setsystemcursor) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetSystemCursor
[SetThreadDesktop](http://msdn2.microsoft.com/en-us/library/619c591f-54b7-4b61-aa07-fc57e05ee37a) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetThreadDesktop
@ -514,12 +489,11 @@ Native Method | Native DLL | Header | Managed Method
[SetThreadDpiHostingBehavior](http://msdn2.microsoft.com/en-us/library/CF31D96A-EC84-4911-81A2-82EC90D417B9) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetThreadDpiHostingBehavior
[SetTimer](https://www.google.com/search?num=5&q=SetTimer+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetTimer
[SetUserObjectInformation](http://msdn2.microsoft.com/en-us/library/42ce6946-1659-41a3-8ba7-21588583b4bd) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetUserObjectInformation
[SetUserObjectSecurity](https://www.google.com/search?num=5&q=SetUserObjectSecurity+site%3Amicrosoft.com) | user32.dll | |
[SetWindowContextHelpId](https://www.google.com/search?num=5&q=SetWindowContextHelpId+site%3Amicrosoft.com) | user32.dll | |
[SetUserObjectSecurity](http://msdn2.microsoft.com/en-us/library/219e41b8-9ac7-4747-a585-b6b9df6a1c9c) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetUserObjectSecurity
[SetWindowContextHelpId](http://msdn2.microsoft.com/en-us/library/7e0963d1-5807-4db5-9abf-cdb21a03b525) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetWindowContextHelpId
[SetWindowDisplayAffinity](http://msdn2.microsoft.com/en-us/library/setwindowdisplayaffinity) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetWindowDisplayAffinity
[SetWindowFeedbackSetting](https://www.google.com/search?num=5&q=SetWindowFeedbackSetting+site%3Amicrosoft.com) | user32.dll | |
[SetWindowFeedbackSetting](http://msdn2.microsoft.com/en-us/library/72bee160-7004-40be-9c91-e431b06ccaed) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetWindowFeedbackSetting
[SetWindowLong](https://www.google.com/search?num=5&q=SetWindowLong+site%3Amicrosoft.com) | user32.dll | | Vanara.PInvoke.User32_Gdi.SetWindowLongPtr32
[SetWindowLong](https://www.google.com/search?num=5&q=SetWindowLongA+site%3Amicrosoft.com) | user32.dll | |
[SetWindowLongPtr](https://www.google.com/search?num=5&q=SetWindowLongPtr+site%3Amicrosoft.com) | user32.dll | | Vanara.PInvoke.User32_Gdi.SetWindowLongPtr64
[SetWindowPlacement](http://msdn2.microsoft.com/en-us/library/setwindowplacement) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetWindowPlacement
[SetWindowPos](http://msdn2.microsoft.com/en-us/library/setwindowpos) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetWindowPos
@ -527,11 +501,11 @@ Native Method | Native DLL | Header | Managed Method
[SetWindowsHookExA](http://msdn2.microsoft.com/en-us/library/setwindowshookex) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetWindowsHookEx
[SetWindowsHookExW](http://msdn2.microsoft.com/en-us/library/setwindowshookex) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetWindowsHookEx
[SetWindowText](http://msdn2.microsoft.com/en-us/library/setwindowtext) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.SetWindowText
[SetWinEventHook](https://www.google.com/search?num=5&q=SetWinEventHook+site%3Amicrosoft.com) | user32.dll | |
[SetWinEventHook](http://msdn2.microsoft.com/en-us/library/090bda1b-0635-4aa3-ae33-3987b36e30b8) | user32.dll | winuser.h | Vanara.PInvoke.User32.SetWinEventHook
[ShowCaret](https://www.google.com/search?num=5&q=ShowCaret+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ShowCaret
[ShowCursor](http://msdn2.microsoft.com/en-us/library/showcursor) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ShowCursor
[ShowOwnedPopups](http://msdn2.microsoft.com/en-us/library/showownedpopups) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ShowOwnedPopups
[ShowScrollBar](https://www.google.com/search?num=5&q=ShowScrollBar+site%3Amicrosoft.com) | user32.dll | |
[ShowScrollBar](https://www.google.com/search?num=5&q=ShowScrollBar+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ShowScrollBar
[ShowWindow](http://msdn2.microsoft.com/en-us/library/showwindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ShowWindow
[ShowWindowAsync](http://msdn2.microsoft.com/en-us/library/showwindowasync) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ShowWindowAsync
[ShutdownBlockReasonCreate](https://www.google.com/search?num=5&q=ShutdownBlockReasonCreate+site%3Amicrosoft.com) | user32.dll | Winuser.h | Vanara.PInvoke.User32.ShutdownBlockReasonCreate
@ -555,38 +529,35 @@ Native Method | Native DLL | Header | Managed Method
[TrackPopupMenu](http://msdn2.microsoft.com/en-us/library/trackpopupmenu.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.TrackPopupMenu
[TrackPopupMenuEx](http://msdn2.microsoft.com/en-us/library/trackpopupmenuex.htm) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.TrackPopupMenuEx
[TranslateAccelerator](https://www.google.com/search?num=5&q=TranslateAccelerator+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.TranslateAccelerator
[TranslateMDISysAccel](https://www.google.com/search?num=5&q=TranslateMDISysAccel+site%3Amicrosoft.com) | user32.dll | |
[TranslateMDISysAccel](https://www.google.com/search?num=5&q=TranslateMDISysAccel+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.TranslateMDISysAccel
[TranslateMessage](https://www.google.com/search?num=5&q=TranslateMessage+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.TranslateMessage
[UnhookWindowsHook](https://www.google.com/search?num=5&q=UnhookWindowsHook+site%3Amicrosoft.com) | user32.dll | |
[UnhookWindowsHookEx](http://msdn2.microsoft.com/en-us/library/unhookwindowshookex) | user32.dll | winuser.h | Vanara.PInvoke.User32.UnhookWindowsHookEx
[UnhookWinEvent](https://www.google.com/search?num=5&q=UnhookWinEvent+site%3Amicrosoft.com) | user32.dll | |
[UnhookWinEvent](http://msdn2.microsoft.com/en-us/library/5cffb279-85e1-4f7a-8bbb-d0d618f6afcd) | user32.dll | winuser.h | Vanara.PInvoke.User32.UnhookWinEvent
[UnionRect](http://msdn2.microsoft.com/en-us/library/f2da2df4-3f09-4c54-afd1-c728805f0f64) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.UnionRect
[UnloadKeyboardLayout](https://www.google.com/search?num=5&q=UnloadKeyboardLayout+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.UnloadKeyboardLayout
[UnpackDDElParam](https://www.google.com/search?num=5&q=UnpackDDElParam+site%3Amicrosoft.com) | user32.dll | |
[UnregisterClass](https://www.google.com/search?num=5&q=UnregisterClassA+site%3Amicrosoft.com) | user32.dll | |
[UnpackDDElParam](https://www.google.com/search?num=5&q=UnpackDDElParam+site%3Amicrosoft.com) | user32.dll | dde.h | Vanara.PInvoke.User32_Gdi.UnpackDDElParam
[UnregisterClass](https://www.google.com/search?num=5&q=UnregisterClassA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.UnregisterClass
[UnregisterDeviceNotification](http://msdn2.microsoft.com/en-us/library/bcc0cf87-f996-47b5-937c-14a6332d00d9) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.UnregisterDeviceNotification
[UnregisterHotKey](http://msdn2.microsoft.com/en-us/library/unregisterhotkey) | user32.dll | winuser.h | Vanara.PInvoke.User32.UnregisterHotKey
[UnregisterPointerInputTarget](https://www.google.com/search?num=5&q=UnregisterPointerInputTarget+site%3Amicrosoft.com) | user32.dll | |
[UnregisterPowerSettingNotification](https://www.google.com/search?num=5&q=UnregisterPowerSettingNotification+site%3Amicrosoft.com) | user32.dll | |
[UnregisterSuspendResumeNotification](https://www.google.com/search?num=5&q=UnregisterSuspendResumeNotification+site%3Amicrosoft.com) | user32.dll | |
[UnregisterPointerInputTarget](http://msdn2.microsoft.com/en-us/library/75faea24-91cd-448b-b67a-09fe530f1800) | user32.dll | winuser.h | Vanara.PInvoke.User32.UnregisterPointerInputTarget
[UnregisterPowerSettingNotification](http://msdn2.microsoft.com/en-us/library/de1509f5-cf4c-448e-bb3b-08da6be53bfa) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.UnregisterPowerSettingNotification
[UnregisterSuspendResumeNotification](http://msdn2.microsoft.com/en-us/library/d9307452-9670-4e9c-9df8-6a3b41d0bd2e) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.UnregisterSuspendResumeNotification
[UnregisterTouchWindow](http://msdn2.microsoft.com/en-us/library/19b83312-b52b-45a5-9595-23d4621c4342) | user32.dll | winuser.h | Vanara.PInvoke.User32.UnregisterTouchWindow
[UpdateLayeredWindow](http://msdn2.microsoft.com/en-us/library/updatelayeredwindow) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.UpdateLayeredWindow
[UpdateLayeredWindowIndirect](http://msdn2.microsoft.com/en-us/library/ms633557) | user32.dll | Winuser.h | Vanara.PInvoke.User32_Gdi.UpdateLayeredWindowIndirect
[UpdateWindow](http://msdn2.microsoft.com/en-us/library/51a50f1f-7b4d-4acd-83a0-1877f5181766) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.UpdateWindow
[UserHandleGrantAccess](https://www.google.com/search?num=5&q=UserHandleGrantAccess+site%3Amicrosoft.com) | user32.dll | |
[UserHandleGrantAccess](http://msdn2.microsoft.com/en-us/library/6e7a6cfc-f881-43cc-a5af-b97e0bf14bf4) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.UserHandleGrantAccess
[ValidateRect](http://msdn2.microsoft.com/en-us/library/961dd768-1849-44df-bc7f-480881ed6477) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ValidateRect
[ValidateRgn](http://msdn2.microsoft.com/en-us/library/80fb1d4a-d9b1-4e67-b585-eee81893ed34) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.ValidateRgn
[VkKeyScan](https://www.google.com/search?num=5&q=VkKeyScanA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.VkKeyScanA
[VkKeyScanEx](https://www.google.com/search?num=5&q=VkKeyScanExA+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32.VkKeyScanExA
[WaitForInputIdle](https://www.google.com/search?num=5&q=WaitForInputIdle+site%3Amicrosoft.com) | user32.dll | |
[WaitForInputIdle](http://msdn2.microsoft.com/en-us/library/2a684921-36f1-438c-895c-5bebc242635a) | user32.dll | winuser.h | Vanara.PInvoke.User32.WaitForInputIdle
[WaitMessage](https://www.google.com/search?num=5&q=WaitMessage+site%3Amicrosoft.com) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.WaitMessage
[WindowFromDC](http://msdn2.microsoft.com/en-us/library/57ecec82-03be-4d1a-84cf-6b64131af19d) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.WindowFromDC
[WindowFromPhysicalPoint](http://msdn2.microsoft.com/en-us/library/windowfromphysicalpoint) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.WindowFromPhysicalPoint
[WindowFromPoint](http://msdn2.microsoft.com/en-us/library/windowfrompoint) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.WindowFromPoint
[WinHelp](https://www.google.com/search?num=5&q=WinHelpA+site%3Amicrosoft.com) | user32.dll | |
[WINNLSEnableIME](https://www.google.com/search?num=5&q=WINNLSEnableIME+site%3Amicrosoft.com) | user32.dll | |
[wsprintf](https://www.google.com/search?num=5&q=wsprintfA+site%3Amicrosoft.com) | user32.dll | |
[wvsprintf](https://www.google.com/search?num=5&q=wvsprintfA+site%3Amicrosoft.com) | user32.dll | |
[WinHelp](http://msdn2.microsoft.com/en-us/library/fce80bac-2a44-46e7-a87a-ef93f4599807) | user32.dll | winuser.h | Vanara.PInvoke.User32_Gdi.WinHelp
[WINNLSEnableIME](https://www.google.com/search?num=5&q=WINNLSEnableIME+site%3Amicrosoft.com) | user32.dll | winnls32.h | Vanara.PInvoke.User32_Gdi.WINNLSEnableIME
### Structures
Native Structure | Header | Managed Structure
--- | --- | ---
@ -616,8 +587,10 @@ Native Structure | Header | Managed Structure
[DLGITEMTEMPLATE](http://msdn2.microsoft.com/en-us/library/dlgitemtemplate) | winuser.h | Vanara.PInvoke.User32_Gdi+DLGITEMTEMPLATE
[DLGTEMPLATE](http://msdn2.microsoft.com/en-us/library/dlgtemplate) | winuser.h | Vanara.PInvoke.User32_Gdi+DLGTEMPLATE
[DPI_AWARENESS_CONTEXT](https://www.google.com/search?num=5&q=DPI_AWARENESS_CONTEXT+site%3Amicrosoft.com) | | Vanara.PInvoke.User32_Gdi+DPI_AWARENESS_CONTEXT
[DRAWTEXTPARAMS](http://msdn2.microsoft.com/en-us/library/d3b89ce2-9a05-42af-b03e-24e1c4d6ef1d) | winuser.h | Vanara.PInvoke.User32_Gdi+DRAWTEXTPARAMS
[EVENTMSG](http://msdn2.microsoft.com/en-us/library/eventmsg.htm) | winuser.h | Vanara.PInvoke.User32+EVENTMSG
[FILTERKEYS](https://www.google.com/search?num=5&q=FILTERKEYS+site%3Amicrosoft.com) | Winuser.h | Vanara.PInvoke.User32+FILTERKEYS
[FLASHWINFO](http://msdn2.microsoft.com/en-us/library/b16636bc-fa77-4eb9-9801-dc2cdf0556e5) | winuser.h | Vanara.PInvoke.User32_Gdi+FLASHWINFO
[GESTURECONFIG](http://msdn2.microsoft.com/en-us/library/4ec5050e-7fef-4f52-89af-5237e8cdbdb8) | winuser.h | Vanara.PInvoke.User32+GESTURECONFIG
[GESTUREINFO](http://msdn2.microsoft.com/en-us/library/f5b8b530-ff1e-4d78-a12f-86990fe9ac88) | winuser.h | Vanara.PInvoke.User32+GESTUREINFO
[GESTURENOTIFYSTRUCT](http://msdn2.microsoft.com/en-us/library/e887c026-9300-4d20-8925-9939a664cd53) | winuser.h | Vanara.PInvoke.User32+GESTURENOTIFYSTRUCT
@ -627,16 +600,19 @@ Native Structure | Header | Managed Structure
[HARDWAREINPUT](https://www.google.com/search?num=5&q=HARDWAREINPUT+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32+HARDWAREINPUT
[HDEVNOTIFY](https://www.google.com/search?num=5&q=HDEVNOTIFY+site%3Amicrosoft.com) | dbt.h | Vanara.PInvoke.User32_Gdi+HDEVNOTIFY
[HELPINFO](https://www.google.com/search?num=5&q=HELPINFO+site%3Amicrosoft.com) | Winuser.h | Vanara.PInvoke.User32+HELPINFO
[HELPWININFO](http://msdn2.microsoft.com/en-us/library/0de0bf84-66f3-44bc-b4de-c2de7ca90cb2) | winuser.h | Vanara.PInvoke.User32_Gdi+HELPWININFO
[HGESTUREINFO](https://www.google.com/search?num=5&q=HGESTUREINFO+site%3Amicrosoft.com) | | Vanara.PInvoke.User32+HGESTUREINFO
[HHOOK](https://www.google.com/search?num=5&q=HHOOK+site%3Amicrosoft.com) | | Vanara.PInvoke.User32+HHOOK
[HIGHCONTRAST](https://www.google.com/search?num=5&q=HIGHCONTRAST+site%3Amicrosoft.com) | Winuser.h | Vanara.PInvoke.User32+HIGHCONTRAST
[HKL](https://www.google.com/search?num=5&q=HKL+site%3Amicrosoft.com) | | Vanara.PInvoke.User32+HKL
[HRAWINPUT](https://www.google.com/search?num=5&q=HRAWINPUT+site%3Amicrosoft.com) | | Vanara.PInvoke.User32+HRAWINPUT
[HTOUCHINPUT](https://www.google.com/search?num=5&q=HTOUCHINPUT+site%3Amicrosoft.com) | | Vanara.PInvoke.User32+HTOUCHINPUT
[HWINEVENTHOOK](https://www.google.com/search?num=5&q=HWINEVENTHOOK+site%3Amicrosoft.com) | | Vanara.PInvoke.User32+HWINEVENTHOOK
[ICONINFO](https://www.google.com/search?num=5&q=ICONINFO+site%3Amicrosoft.com) | | Vanara.PInvoke.User32_Gdi+ICONINFO
[ICONINFOEX](http://msdn2.microsoft.com/en-us/library/iconinfoex) | winuser.h | Vanara.PInvoke.User32_Gdi+ICONINFOEX
[ICONMETRICS](https://www.google.com/search?num=5&q=ICONMETRICS+site%3Amicrosoft.com) | Winuser.h | Vanara.PInvoke.User32+ICONMETRICS
[INPUT](https://www.google.com/search?num=5&q=INPUT+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32+INPUT
[INPUT_MESSAGE_SOURCE](http://msdn2.microsoft.com/en-us/library/75437c0a-925a-44d9-9254-43095b281c21) | winuser.h | Vanara.PInvoke.User32+INPUT_MESSAGE_SOURCE
[INPUT_TRANSFORM](http://msdn2.microsoft.com/en-us/library/DE6854F0-17D8-4E4B-97CB-A135910A300C) | winuser.h | Vanara.PInvoke.User32+INPUT_TRANSFORM
[KBDLLHOOKSTRUCT](http://msdn2.microsoft.com/en-us/library/kbdllhookstruct.htm) | winuser.h | Vanara.PInvoke.User32+KBDLLHOOKSTRUCT
[KEYBDINPUT](https://www.google.com/search?num=5&q=KEYBDINPUT+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32+KEYBDINPUT
@ -662,9 +638,13 @@ Native Structure | Header | Managed Structure
[MOUSEMOVEPOINT](https://www.google.com/search?num=5&q=MOUSEMOVEPOINT+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32+MOUSEMOVEPOINT
[MSGBOXPARAMS](https://www.google.com/search?num=5&q=MSGBOXPARAMS+site%3Amicrosoft.com) | Winuser.h | Vanara.PInvoke.User32+MSGBOXPARAMS
[MSLLHOOKSTRUCT](http://msdn2.microsoft.com/en-us/library/msllhookstruct.htm) | winuser.h | Vanara.PInvoke.User32+MSLLHOOKSTRUCT
[MULTIKEYHELP](http://msdn2.microsoft.com/en-us/library/5fe0cd44-196c-4d9a-b9f8-2a97a92f2545) | winuser.h | Vanara.PInvoke.User32_Gdi+MULTIKEYHELP
[NMHDR](https://www.google.com/search?num=5&q=NMHDR+site%3Amicrosoft.com) | | Vanara.PInvoke.User32_Gdi+NMHDR
[NONCLIENTMETRICS](http://msdn2.microsoft.com/en-us/library/ff729175) | Winuser.h | Vanara.PInvoke.User32+NONCLIENTMETRICS
[PAINTSTRUCT](http://msdn2.microsoft.com/en-us/library/1f8c6dd2-e511-48f2-8ab0-d2fadb1ce433) | winuser.h | Vanara.PInvoke.User32_Gdi+PAINTSTRUCT
[POINTER_DEVICE_CURSOR_INFO](http://msdn2.microsoft.com/en-us/library/5d71e5b4-95eb-453e-9164-e7659ef4059e) | winuser.h | Vanara.PInvoke.User32+POINTER_DEVICE_CURSOR_INFO
[POINTER_DEVICE_INFO](http://msdn2.microsoft.com/en-us/library/1b909caf-2d69-42b9-8d60-5d89a0286f59) | winuser.h | Vanara.PInvoke.User32+POINTER_DEVICE_INFO
[POINTER_DEVICE_PROPERTY](http://msdn2.microsoft.com/en-us/library/2c96379e-7c9f-440c-a98b-bda38bacd33f) | winuser.h | Vanara.PInvoke.User32+POINTER_DEVICE_PROPERTY
[POINTER_INFO](http://msdn2.microsoft.com/en-us/library/fee176ba-ad07-4145-0b4d-1b8c335fd102) | winuser.h | Vanara.PInvoke.User32+POINTER_INFO
[POINTER_PEN_INFO](http://msdn2.microsoft.com/en-us/library/fee176ba-ad07-4141-ab4d-1b8c335fd111) | winuser.h | Vanara.PInvoke.User32+POINTER_PEN_INFO
[POINTER_TOUCH_INFO](http://msdn2.microsoft.com/en-us/library/fee176ba-ad07-3141-ab4d-1b8c335fd102) | winuser.h | Vanara.PInvoke.User32+POINTER_TOUCH_INFO
@ -679,11 +659,15 @@ Native Structure | Header | Managed Structure
[RID_DEVICE_INFO_HID](https://www.google.com/search?num=5&q=RID_DEVICE_INFO_HID+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32+RID_DEVICE_INFO_HID
[RID_DEVICE_INFO_KEYBOARD](https://www.google.com/search?num=5&q=RID_DEVICE_INFO_KEYBOARD+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32+RID_DEVICE_INFO_KEYBOARD
[RID_DEVICE_INFO_MOUSE](https://www.google.com/search?num=5&q=RID_DEVICE_INFO_MOUSE+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32+RID_DEVICE_INFO_MOUSE
[SCROLLBARINFO](https://www.google.com/search?num=5&q=SCROLLBARINFO+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32_Gdi+SCROLLBARINFO
[SCROLLINFO](https://www.google.com/search?num=5&q=SCROLLINFO+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32_Gdi+SCROLLINFO
[SERIALKEYS](https://www.google.com/search?num=5&q=SERIALKEYS+site%3Amicrosoft.com) | Winuser.h | Vanara.PInvoke.User32+SERIALKEYS
[SOUNDSENTRY](https://www.google.com/search?num=5&q=SOUNDSENTRY+site%3Amicrosoft.com) | Winuser.h | Vanara.PInvoke.User32+SOUNDSENTRY
[STICKYKEYS](https://www.google.com/search?num=5&q=STICKYKEYS+site%3Amicrosoft.com) | Winuser.h | Vanara.PInvoke.User32+STICKYKEYS
[TITLEBARINFO](http://msdn2.microsoft.com/en-us/library/titlebarinfo) | winuser.h | Vanara.PInvoke.User32_Gdi+TITLEBARINFO
[TOGGLEKEYS](https://www.google.com/search?num=5&q=TOGGLEKEYS+site%3Amicrosoft.com) | Winuser.h | Vanara.PInvoke.User32+TOGGLEKEYS
[TOUCH_HIT_TESTING_INPUT](http://msdn2.microsoft.com/en-us/library/d2103f6e-6aa9-4260-bef9-cfcbec35e675) | winuser.h | Vanara.PInvoke.User32+TOUCH_HIT_TESTING_INPUT
[TOUCH_HIT_TESTING_PROXIMITY_EVALUATION](http://msdn2.microsoft.com/en-us/library/a26facc3-fe63-4657-9bd6-821dd89cb11d) | winuser.h | Vanara.PInvoke.User32+TOUCH_HIT_TESTING_PROXIMITY_EVALUATION
[TOUCHINPUT](http://msdn2.microsoft.com/en-us/library/fc382759-3a1e-401e-a6a7-1bf209a5434b) | winuser.h | Vanara.PInvoke.User32+TOUCHINPUT
[TOUCHPREDICTIONPARAMETERS](http://msdn2.microsoft.com/en-us/library/hh969214) | Winuser.h | Vanara.PInvoke.User32+TOUCHPREDICTIONPARAMETERS
[TPMPARAMS](http://msdn2.microsoft.com/en-us/library/tpmparams.htm) | winuser.h | Vanara.PInvoke.User32_Gdi+TPMPARAMS
@ -695,3 +679,5 @@ Native Structure | Header | Managed Structure
[WINDOWINFO](http://msdn2.microsoft.com/en-us/library/windowinfo) | winuser.h | Vanara.PInvoke.User32_Gdi+WINDOWINFO
[WINDOWPLACEMENT](http://msdn2.microsoft.com/en-us/library/windowplacement) | winuser.h | Vanara.PInvoke.User32_Gdi+WINDOWPLACEMENT
[WINDOWPOS](https://www.google.com/search?num=5&q=WINDOWPOS+site%3Amicrosoft.com) | | Vanara.PInvoke.User32_Gdi+WINDOWPOS
[WNDCLASS](https://www.google.com/search?num=5&q=WNDCLASS+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32_Gdi+WNDCLASS
[WNDCLASSEX](https://www.google.com/search?num=5&q=WNDCLASSEX+site%3Amicrosoft.com) | winuser.h | Vanara.PInvoke.User32_Gdi+WNDCLASSEX

File diff suppressed because one or more lines are too long

View File

@ -21,6 +21,62 @@ namespace Vanara.PInvoke
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
/// <summary>
/// <para>
/// An application-defined callback (or hook) function that the system calls in response to events generated by an accessible object.
/// The hook function processes the event notifications as required. Clients install the hook function and request specific types of
/// event notifications by calling SetWinEventHook.
/// </para>
/// <para>
/// The WINEVENTPROC type defines a pointer to this callback function. WinEventProc is a placeholder for the application-defined
/// function name.
/// </para>
/// </summary>
/// <param name="hWinEventHook">
/// <para>Type: <c>HWINEVENTHOOK</c></para>
/// <para>
/// Handle to an event hook function. This value is returned by SetWinEventHook when the hook function is installed and is specific
/// to each instance of the hook function.
/// </para>
/// </param>
/// <param name="winEvent">
/// <para>Type: <c>DWORD</c></para>
/// <para>Specifies the event that occurred. This value is one of the event constants.</para>
/// </param>
/// <param name="hwnd">
/// <para>Type: <c>HWND</c></para>
/// <para>
/// Handle to the window that generates the event, or <c>NULL</c> if no window is associated with the event. For example, the mouse
/// pointer is not associated with a window.
/// </para>
/// </param>
/// <param name="idObject">
/// <para>Type: <c>LONG</c></para>
/// <para>Identifies the object associated with the event. This is one of the object identifiers or a custom object ID.</para>
/// </param>
/// <param name="idChild">
/// <para>Type: <c>LONG</c></para>
/// <para>
/// Identifies whether the event was triggered by an object or a child element of the object. If this value is CHILDID_SELF, the
/// event was triggered by the object; otherwise, this value is the child ID of the element that triggered the event.
/// </para>
/// </param>
/// <param name="idEventThread">The identifier event thread.</param>
/// <param name="dwmsEventTime">
/// <para>Type: <c>DWORD</c></para>
/// <para>Specifies the time, in milliseconds, that the event was generated.</para>
/// </param>
/// <remarks>
/// <para>Within the hook function, the parameters hwnd, idObject, and idChild are used when calling AccessibleObjectFromEvent.</para>
/// <para>Servers generate events by calling NotifyWinEvent.</para>
/// <para>Create multiple callback functions to handle different events. For more information, see Registering a Hook Function.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nc-winuser-wineventproc WINEVENTPROC Wineventproc; void Wineventproc(
// HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD idEventThread, DWORD dwmsEventTime ) {...}
[PInvokeData("winuser.h", MSDNShortId = "5fe3cacc-4563-43da-960d-729d3fe4ff70")]
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void WINEVENTPROC(HWINEVENTHOOK hWinEventHook, uint winEvent, HWND hwnd, int idObject, int idChild, uint idEventThread, uint dwmsEventTime);
/// <summary>The type of hook procedure to be installed.</summary>
[PInvokeData("WinUser.h", MSDNShortId = "ms644990")]
public enum HookType
@ -112,6 +168,38 @@ namespace Vanara.PInvoke
WH_MOUSE_LL = 14
}
/// <summary>Flags for <see cref="SetWinEventHook"/>.</summary>
[PInvokeData("winuser.h", MSDNShortId = "090bda1b-0635-4aa3-ae33-3987b36e30b8")]
[Flags]
public enum WINEVENT
{
/// <summary>
/// The DLL that contains the callback function is mapped into the address space of the process that generates the event. With
/// this flag, the system sends event notifications to the callback function as they occur. The hook function must be in a DLL
/// when this flag is specified. This flag has no effect when both the calling process and the generating process are not 32-bit
/// or 64-bit processes, or when the generating process is a console application. For more information, see In-Context Hook Functions.
/// </summary>
WINEVENT_INCONTEXT = 0,
/// <summary>
/// The callback function is not mapped into the address space of the process that generates the event. Because the hook function
/// is called across process boundaries, the system must queue events. Although this method is asynchronous, events are
/// guaranteed to be in sequential order. For more information, see Out-of-Context Hook Functions.
/// </summary>
WINEVENT_OUTOFCONTEXT = 1,
/// <summary>
/// Prevents this instance of the hook from receiving the events that are generated by threads in this process. This flag does
/// not prevent threads from generating events.
/// </summary>
WINEVENT_SKIPOWNPROCESS = 2,
/// <summary>
/// Prevents this instance of the hook from receiving the events that are generated by the thread that is registering this hook.
/// </summary>
WINEVENT_SKIPOWNTHREAD = 4,
}
/// <summary>
/// <para>
/// Passes the specified message and hook code to the hook procedures associated with the WH_SYSMSGFILTER and WH_MSGFILTER hooks. A
@ -202,6 +290,34 @@ namespace Vanara.PInvoke
[PInvokeData("winuser.h", MSDNShortId = "callnexthookex")]
public static extern IntPtr CallNextHookEx(HHOOK hhk, int nCode, IntPtr wParam, IntPtr lParam);
/// <summary>Determines whether there is an installed WinEvent hook that might be notified of a specified event.</summary>
/// <param name="winEvent">
/// <para>Type: <c>DWORD</c></para>
/// <para>
/// The event constant that hooks might be notified of. The function checks whether there is an installed hook for this event constant.
/// </para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>If there is a hook to be notified of the specified event, the return value is <c>TRUE</c>.</para>
/// <para>If there are no hooks to be notified of the specified event, the return value is <c>FALSE</c>.</para>
/// </returns>
/// <remarks>
/// <para>
/// This method is guaranteed to never return a false negative. If this method returns <c>FALSE</c>, it means that no hooks in the
/// system would be notified of the event. However, this method may return a false positive. In other words, it may return
/// <c>TRUE</c> even though there are no hooks that would be notified. Thus, it is safe for components to circumvent some work if
/// this method returns <c>FALSE</c>.
/// </para>
/// <para>Event hooks can be installed at any time, so server developers should not cache the return value for long periods of time.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-iswineventhookinstalled BOOL IsWinEventHookInstalled(
// DWORD event );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "bc1e97ad-748d-420a-8c9a-72a555b685e1")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsWinEventHookInstalled(uint winEvent);
/// <summary>
/// <para>
/// Installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for
@ -496,6 +612,158 @@ namespace Vanara.PInvoke
[PInvokeData("winuser.h", MSDNShortId = "setwindowshookex")]
public static extern SafeHHOOK SetWindowsHookEx(HookType idHook, HookProc lpfn, HINSTANCE hmod, int dwThreadId);
/// <summary>Sets an event hook function for a range of events.</summary>
/// <param name="eventMin">
/// <para>Type: <c>UINT</c></para>
/// <para>
/// Specifies the event constant for the lowest event value in the range of events that are handled by the hook function. This
/// parameter can be set to <c>EVENT_MIN</c> to indicate the lowest possible event value.
/// </para>
/// </param>
/// <param name="eventMax">
/// <para>Type: <c>UINT</c></para>
/// <para>
/// Specifies the event constant for the highest event value in the range of events that are handled by the hook function. This
/// parameter can be set to EVENT_MAX to indicate the highest possible event value.
/// </para>
/// </param>
/// <param name="hmodWinEventProc">
/// <para>Type: <c>HMODULE</c></para>
/// <para>
/// Handle to the DLL that contains the hook function at lpfnWinEventProc, if the WINEVENT_INCONTEXT flag is specified in the dwFlags
/// parameter. If the hook function is not located in a DLL, or if the WINEVENT_OUTOFCONTEXT flag is specified, this parameter is <c>NULL</c>.
/// </para>
/// </param>
/// <param name="pfnWinEventProc">
/// <para>Type: <c>WINEVENTPROC</c></para>
/// <para>Pointer to the event hook function. For more information about this function, see WinEventProc.</para>
/// </param>
/// <param name="idProcess">
/// <para>Type: <c>DWORD</c></para>
/// <para>
/// Specifies the ID of the process from which the hook function receives events. Specify zero (0) to receive events from all
/// processes on the current desktop.
/// </para>
/// </param>
/// <param name="idThread">
/// <para>Type: <c>DWORD</c></para>
/// <para>
/// Specifies the ID of the thread from which the hook function receives events. If this parameter is zero, the hook function is
/// associated with all existing threads on the current desktop.
/// </para>
/// </param>
/// <param name="dwFlags">
/// <para>Type: <c>UINT</c></para>
/// <para>Flag values that specify the location of the hook function and of the events to be skipped. The following flags are valid:</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>WINEVENT_INCONTEXT</term>
/// <term>
/// The DLL that contains the callback function is mapped into the address space of the process that generates the event. With this
/// flag, the system sends event notifications to the callback function as they occur. The hook function must be in a DLL when this
/// flag is specified. This flag has no effect when both the calling process and the generating process are not 32-bit or 64-bit
/// processes, or when the generating process is a console application. For more information, see In-Context Hook Functions.
/// </term>
/// </item>
/// <item>
/// <term>WINEVENT_OUTOFCONTEXT</term>
/// <term>
/// The callback function is not mapped into the address space of the process that generates the event. Because the hook function is
/// called across process boundaries, the system must queue events. Although this method is asynchronous, events are guaranteed to be
/// in sequential order. For more information, see Out-of-Context Hook Functions.
/// </term>
/// </item>
/// <item>
/// <term>WINEVENT_SKIPOWNPROCESS</term>
/// <term>
/// Prevents this instance of the hook from receiving the events that are generated by threads in this process. This flag does not
/// prevent threads from generating events.
/// </term>
/// </item>
/// <item>
/// <term>WINEVENT_SKIPOWNTHREAD</term>
/// <term>
/// Prevents this instance of the hook from receiving the events that are generated by the thread that is registering this hook.
/// </term>
/// </item>
/// </list>
/// <para>The following flag combinations are valid:</para>
/// <list type="bullet">
/// <item>
/// <term>WINEVENT_INCONTEXT | WINEVENT_SKIPOWNPROCESS</term>
/// </item>
/// <item>
/// <term>WINEVENT_INCONTEXT | WINEVENT_SKIPOWNTHREAD</term>
/// </item>
/// <item>
/// <term>WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS</term>
/// </item>
/// <item>
/// <term>WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNTHREAD</term>
/// </item>
/// </list>
/// <para>Additionally, client applications can specify WINEVENT_INCONTEXT, or WINEVENT_OUTOFCONTEXT alone.</para>
/// <para>See Remarks section for information on Windows Store app development.</para>
/// </param>
/// <returns>
/// <para>Type: <c>HWINEVENTHOOK</c></para>
/// <para>
/// If successful, returns an HWINEVENTHOOK value that identifies this event hook instance. Applications save this return value to
/// use it with the UnhookWinEvent function.
/// </para>
/// <para>If unsuccessful, returns zero.</para>
/// </returns>
/// <remarks>
/// <para>This function allows clients to specify which processes and threads they are interested in.</para>
/// <para>
/// If the idProcess parameter is nonzero and idThread is zero, the hook function receives the specified events from all threads in
/// that process. If the idProcess parameter is zero and idThread is nonzero, the hook function receives the specified events only
/// from the thread specified by idThread. If both are zero, the hook function receives the specified events from all threads and processes.
/// </para>
/// <para>
/// Clients can call <c>SetWinEventHook</c> multiple times if they want to register additional hook functions or listen for
/// additional events.
/// </para>
/// <para>The client thread that calls <c>SetWinEventHook</c> must have a message loop in order to receive events.</para>
/// <para>
/// When you use <c>SetWinEventHook</c> to set a callback in managed code, you should use the GCHandle structure to avoid exceptions.
/// This tells the garbage collector not to move the callback.
/// </para>
/// <para>
/// For out-of-context events, the event is delivered on the same thread that called <c>SetWinEventHook</c>. In some situations, even
/// if you request WINEVENT_INCONTEXT events, the events will still be delivered out-of-context. These scenarios include events from
/// console windows and events from processes that have a different bit-depth (64 bit versus 32 bits) than the caller.
/// </para>
/// <para>
/// While a hook function processes an event, additional events may be triggered, which may cause the hook function to reenter before
/// the processing for the original event is finished. The problem with reentrancy in hook functions is that events are completed out
/// of sequence unless the hook function handles this situation. For more information, see Guarding Against Reentrancy.
/// </para>
/// <para>
/// <c>Windows Store app development</c> If dwFlags is WINEVENT_INCONTEXT AND (idProcess = 0 | idThread = 0), then window hook DLLs
/// are not loaded in-process for the Windows Store app processes and the Windows Runtime broker process unless they are installed by
/// UIAccess processes (accessibility tools). The notification is delivered on the installer's thread.
/// </para>
/// <para>
/// This behavior is similar to what happens when there is an architecture mismatch between the hook DLL and the target application
/// process, for example, when the hook DLL is 32-bit and the application process 64-bit.
/// </para>
/// <para>Examples</para>
/// <para>
/// The following example code shows how a client application might listen for menu-start and menu-end events. For simplicity, the
/// event handler just sends some information to the standard output.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setwineventhook HWINEVENTHOOK SetWinEventHook( DWORD
// eventMin, DWORD eventMax, HMODULE hmodWinEventProc, WINEVENTPROC pfnWinEventProc, DWORD idProcess, DWORD idThread, DWORD dwFlags );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "090bda1b-0635-4aa3-ae33-3987b36e30b8")]
public static extern HWINEVENTHOOK SetWinEventHook(uint eventMin, uint eventMax, HINSTANCE hmodWinEventProc, WINEVENTPROC pfnWinEventProc, uint idProcess, uint idThread, WINEVENT dwFlags);
/// <summary>
/// <para>Removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.</para>
/// </summary>
@ -522,6 +790,49 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UnhookWindowsHookEx(HHOOK hhk);
/// <summary>Removes an event hook function created by a previous call to SetWinEventHook.</summary>
/// <param name="hWinEventHook">
/// <para>Type: <c>HWINEVENTHOOK</c></para>
/// <para>Handle to the event hook returned in the previous call to SetWinEventHook.</para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>If successful, returns <c>TRUE</c>; otherwise, returns <c>FALSE</c>.</para>
/// <para>Three common errors cause this function to fail:</para>
/// <list type="bullet">
/// <item>
/// <term>The hWinEventHook parameter is <c>NULL</c> or not valid.</term>
/// </item>
/// <item>
/// <term>The event hook specified by hWinEventHook was already removed.</term>
/// </item>
/// <item>
/// <term><c>UnhookWinEvent</c> is called from a thread that is different from the original call to SetWinEventHook.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// This function removes the event hook specified by hWinEventHook that prevents the corresponding callback function from receiving
/// further event notifications. If the client's thread ends, the system automatically calls this function.
/// </para>
/// <para>
/// Call this function from the same thread that installed the event hook. <c>UnhookWinEvent</c> fails if called from a thread
/// different from the call that corresponds to SetWinEventHook.
/// </para>
/// <para>
/// If WINEVENT_INCONTEXT was specified when this event hook was installed, the system attempts to unload the corresponding DLL from
/// all processes that loaded it. Although unloading does not occur immediately, the hook function is not called after
/// <c>UnhookWinEvent</c> returns. For more information on WINEVENT_INCONTEXT, see In-Context Hook Functions.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-unhookwinevent BOOL UnhookWinEvent( HWINEVENTHOOK
// hWinEventHook );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "5cffb279-85e1-4f7a-8bbb-d0d618f6afcd")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UnhookWinEvent(HWINEVENTHOOK hWinEventHook);
/// <summary>
/// <para>Contains information passed to a <c>WH_CBT</c> hook procedure, CBTProc, before a window is created.</para>
/// </summary>
@ -775,6 +1086,54 @@ namespace Vanara.PInvoke
public IntPtr DangerousGetHandle() => handle;
}
/// <summary>Provides a handle to a Windows Event Hook.</summary>
[StructLayout(LayoutKind.Sequential)]
public struct HWINEVENTHOOK : IHandle
{
private IntPtr handle;
/// <summary>Initializes a new instance of the <see cref="HWINEVENTHOOK"/> struct.</summary>
/// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
public HWINEVENTHOOK(IntPtr preexistingHandle) => handle = preexistingHandle;
/// <summary>Returns an invalid handle by instantiating a <see cref="HWINEVENTHOOK"/> object with <see cref="IntPtr.Zero"/>.</summary>
public static HWINEVENTHOOK NULL => new HWINEVENTHOOK(IntPtr.Zero);
/// <summary>Gets a value indicating whether this instance is a null handle.</summary>
public bool IsNull => handle == IntPtr.Zero;
/// <summary>Performs an explicit conversion from <see cref="HWINEVENTHOOK"/> to <see cref="IntPtr"/>.</summary>
/// <param name="h">The handle.</param>
/// <returns>The result of the conversion.</returns>
public static explicit operator IntPtr(HWINEVENTHOOK h) => h.handle;
/// <summary>Performs an implicit conversion from <see cref="IntPtr"/> to <see cref="HWINEVENTHOOK"/>.</summary>
/// <param name="h">The pointer to a handle.</param>
/// <returns>The result of the conversion.</returns>
public static implicit operator HWINEVENTHOOK(IntPtr h) => new HWINEVENTHOOK(h);
/// <summary>Implements the operator !=.</summary>
/// <param name="h1">The first handle.</param>
/// <param name="h2">The second handle.</param>
/// <returns>The result of the operator.</returns>
public static bool operator !=(HWINEVENTHOOK h1, HWINEVENTHOOK h2) => !(h1 == h2);
/// <summary>Implements the operator ==.</summary>
/// <param name="h1">The first handle.</param>
/// <param name="h2">The second handle.</param>
/// <returns>The result of the operator.</returns>
public static bool operator ==(HWINEVENTHOOK h1, HWINEVENTHOOK h2) => h1.Equals(h2);
/// <inheritdoc/>
public override bool Equals(object obj) => obj is HWINEVENTHOOK h ? handle == h.handle : false;
/// <inheritdoc/>
public override int GetHashCode() => handle.GetHashCode();
/// <inheritdoc/>
public IntPtr DangerousGetHandle() => handle;
}
/// <summary>
/// <para>Contains information about a low-level keyboard input event.</para>
/// </summary>

View File

@ -5,6 +5,61 @@ namespace Vanara.PInvoke
{
public static partial class User32
{
/// <summary>
/// <para>The type of device that sent the input message.</para>
/// </summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ne-winuser-input_message_device_type typedef enum
// tagINPUT_MESSAGE_DEVICE_TYPE { IMDT_UNAVAILABLE, IMDT_KEYBOARD, IMDT_MOUSE, IMDT_TOUCH, IMDT_PEN, IMDT_TOUCHPAD } INPUT_MESSAGE_DEVICE_TYPE;
[PInvokeData("winuser.h", MSDNShortId = "aaaa8d9b-1056-4fa3-afcf-43d2c4b41c0e")]
[Flags]
public enum INPUT_MESSAGE_DEVICE_TYPE
{
/// <summary>The device type isn't identified.</summary>
IMDT_UNAVAILABLE = 0x00,
/// <summary>Keyboard input.</summary>
IMDT_KEYBOARD = 0x01,
/// <summary>Mouse input.</summary>
IMDT_MOUSE = 0x02,
/// <summary>Touch input.</summary>
IMDT_TOUCH = 0x04,
/// <summary>Pen or stylus input.</summary>
IMDT_PEN = 0x08,
/// <summary>Touchpad input (Windows 8.1 and later).</summary>
IMDT_TOUCHPAD = 0x10,
}
/// <summary>The ID of the input message source.</summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ne-winuser-input_message_origin_id typedef enum
// tagINPUT_MESSAGE_ORIGIN_ID { IMO_UNAVAILABLE, IMO_HARDWARE, IMO_INJECTED, IMO_SYSTEM } INPUT_MESSAGE_ORIGIN_ID;
[PInvokeData("winuser.h", MSDNShortId = "5637bf3a-9fd8-4c89-acd0-4e0e47c0a3bf")]
[Flags]
public enum INPUT_MESSAGE_ORIGIN_ID
{
/// <summary>The source isn't identified.</summary>
IMO_UNAVAILABLE = 0x00,
/// <summary>
/// The input message is from a hardware device or has been injected into the message queue by an application that has the
/// UIAccess attribute set to TRUE in its manifest file. For more information about the UIAccess attribute and application
/// manifests, see UAC References.
/// </summary>
IMO_HARDWARE = 0x01,
/// <summary>
/// The input message has been injected (through the SendInput function) by an application that doesn't have the UIAccess
/// attribute set to TRUE in its manifest file.
/// </summary>
IMO_INJECTED = 0x02,
/// <summary>The system has injected the input message.</summary>
IMO_SYSTEM = 0x04,
}
/// <summary>Type for <see cref="INPUT"/> structure.</summary>
[PInvokeData("winuser.h", MSDNShortId = "")]
public enum INPUTTYPE
@ -241,6 +296,25 @@ namespace Vanara.PInvoke
[PInvokeData("winuser.h")]
public static extern IntPtr DefRawInputProc(RAWINPUT[] paRawInput, int nInput, uint cbSizeHeader);
/// <summary>Retrieves the source of the input message.</summary>
/// <param name="inputMessageSource">
/// <para>The INPUT_MESSAGE_SOURCE structure that holds the device type and the ID of the input message source.</para>
/// <para>
/// <c>Note</c><c>deviceType</c> in INPUT_MESSAGE_SOURCE is set to IMDT_UNAVAILABLE when SendMessage is used to inject input (system
/// generated or through messages such as WM_PAINT). This remains true until <c>SendMessage</c> returns.
/// </para>
/// </param>
/// <returns>
/// If this function succeeds, it returns TRUE. Otherwise, it returns FALSE. To retrieve extended error information, call the
/// GetLastError function.
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getcurrentinputmessagesource BOOL
// GetCurrentInputMessageSource( INPUT_MESSAGE_SOURCE *inputMessageSource );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "35e4ebf5-df9d-4168-9996-355204c2ab93")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetCurrentInputMessageSource(ref INPUT_MESSAGE_SOURCE inputMessageSource);
/// <summary>Retrieves the time of the last input event.</summary>
/// <param name="plii">
/// <para>Type: <c>PLASTINPUTINFO</c></para>
@ -720,6 +794,20 @@ namespace Vanara.PInvoke
public HARDWAREINPUT hi;
}
/// <summary>Contains information about the source of the input message.</summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-taginput_message_source typedef struct
// tagINPUT_MESSAGE_SOURCE { INPUT_MESSAGE_DEVICE_TYPE deviceType; INPUT_MESSAGE_ORIGIN_ID originId; } INPUT_MESSAGE_SOURCE;
[PInvokeData("winuser.h", MSDNShortId = "75437c0a-925a-44d9-9254-43095b281c21")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct INPUT_MESSAGE_SOURCE
{
/// <summary>The device type (INPUT_MESSAGE_DEVICE_TYPE) of the source of the input message.</summary>
public INPUT_MESSAGE_DEVICE_TYPE deviceType;
/// <summary>The ID (INPUT_MESSAGE_ORIGIN_ID) of the source of the input message.</summary>
public INPUT_MESSAGE_ORIGIN_ID originId;
}
/// <summary>Contains the time of the last input.</summary>
/// <remarks>This function is useful for input idle detection. For more information on tick counts, see GetTickCount.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-taglastinputinfo typedef struct tagLASTINPUTINFO { UINT

View File

@ -88,6 +88,48 @@ namespace Vanara.PInvoke
POINTER_CHANGE_FIFTHBUTTON_UP,
}
/// <summary>Identifies the pointer device cursor types.</summary>
/// <remarks>
/// Cursor objects represent pointing and selecting devices used with digitizer devices, most commonly tactile contacts on touch
/// digitizers and tablet pens on pen digitizers. Physical pens may have multiple tips (such as normal and eraser ends), with each
/// pen tip representing a different cursor object. Each cursor object has an associated cursor identifier.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ne-winuser-pointer_device_cursor_type typedef enum
// tagPOINTER_DEVICE_CURSOR_TYPE { POINTER_DEVICE_CURSOR_TYPE_UNKNOWN, POINTER_DEVICE_CURSOR_TYPE_TIP,
// POINTER_DEVICE_CURSOR_TYPE_ERASER, POINTER_DEVICE_CURSOR_TYPE_MAX } POINTER_DEVICE_CURSOR_TYPE;
[PInvokeData("winuser.h", MSDNShortId = "ebd5c0c6-a949-42f1-976e-96d143b1a0d7")]
public enum POINTER_DEVICE_CURSOR_TYPE
{
/// <summary>Unidentified cursor.</summary>
POINTER_DEVICE_CURSOR_TYPE_UNKNOWN,
/// <summary>Pen tip.</summary>
POINTER_DEVICE_CURSOR_TYPE_TIP,
/// <summary>Pen eraser.</summary>
POINTER_DEVICE_CURSOR_TYPE_ERASER,
}
/// <summary>Identifies the pointer device types.</summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ne-winuser-pointer_device_type typedef enum tagPOINTER_DEVICE_TYPE {
// POINTER_DEVICE_TYPE_INTEGRATED_PEN, POINTER_DEVICE_TYPE_EXTERNAL_PEN, POINTER_DEVICE_TYPE_TOUCH, POINTER_DEVICE_TYPE_TOUCH_PAD,
// POINTER_DEVICE_TYPE_MAX } POINTER_DEVICE_TYPE;
[PInvokeData("winuser.h", MSDNShortId = "7702adec-e24f-4dc8-b5d4-f1f9dbcb5ed0")]
public enum POINTER_DEVICE_TYPE : uint
{
/// <summary>Direct pen digitizer (integrated into display).</summary>
POINTER_DEVICE_TYPE_INTEGRATED_PEN = 1,
/// <summary>Indirect pen digitizer (not integrated into display).</summary>
POINTER_DEVICE_TYPE_EXTERNAL_PEN,
/// <summary>Touch digitizer.</summary>
POINTER_DEVICE_TYPE_TOUCH,
/// <summary>Touchpad digitizer (Windows 8.1 and later).</summary>
POINTER_DEVICE_TYPE_TOUCH_PAD,
}
/// <summary>Values that can appear in the <c>pointerFlags</c> field of the <c>POINTER_INFO</c> structure.</summary>
/// <remarks>
/// XBUTTON1 and XBUTTON2 are additional buttons used on many mouse devices. They return the same data as standard mouse buttons.
@ -318,6 +360,112 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetPointerCursorId(uint pointerId, out uint cursorId);
/// <summary>Gets information about the pointer device.</summary>
/// <param name="device">The handle to the device.</param>
/// <param name="pointerDevice">A POINTER_DEVICE_INFO structure that contains information about the pointer device.</param>
/// <returns>
/// <para>If this function succeeds, it returns TRUE.</para>
/// <para>Otherwise, it returns FALSE. To retrieve extended error information, call the GetLastError function.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getpointerdevice BOOL GetPointerDevice( HANDLE device,
// POINTER_DEVICE_INFO *pointerDevice );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[PInvokeData("winuser.h", MSDNShortId = "800E0BFE-6E57-4EAA-B47C-FEEC0B5BFA2F")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetPointerDevice(HANDLE device, out POINTER_DEVICE_INFO pointerDevice);
/// <summary>Gets the cursor IDs that are mapped to the cursors associated with a pointer device.</summary>
/// <param name="device">The device handle.</param>
/// <param name="cursorCount">The number of cursors associated with the pointer device.</param>
/// <param name="deviceCursors">
/// An array of POINTER_DEVICE_CURSOR_INFO structures that contain info about the cursors. If NULL, cursorCount returns the number of
/// cursors associated with the pointer device.
/// </param>
/// <returns>
/// TRUE if the function succeeds; otherwise, FALSE. If the function fails, call the GetLastError function for more information.
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getpointerdevicecursors BOOL GetPointerDeviceCursors(
// HANDLE device, UINT32 *cursorCount, POINTER_DEVICE_CURSOR_INFO *deviceCursors );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "4dd25033-e63a-4fa9-89b9-bfcae4061a76")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetPointerDeviceCursors(HANDLE device, ref uint cursorCount, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]POINTER_DEVICE_CURSOR_INFO[] deviceCursors);
/// <summary>Gets device properties that aren't included in the POINTER_DEVICE_INFO structure.</summary>
/// <param name="device">
/// <para>The pointer device to query properties from.</para>
/// <para>A call to the GetPointerDevices function returns this handle in the POINTER_DEVICE_INFO structure.</para>
/// </param>
/// <param name="propertyCount">
/// <para>The number of properties.</para>
/// <para>Returns the count that's written or needed if pointerProperties is NULL.</para>
/// <para>
/// If this value is less than the number of properties that the pointer device supports and pointerProperties is not NULL, the
/// function returns the actual number of properties in this variable and fails.
/// </para>
/// </param>
/// <param name="pointerProperties">The array of properties.</param>
/// <returns>
/// TRUE if the function succeeds; otherwise, FALSE. If the function fails, call the GetLastError function for more information.
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getpointerdeviceproperties BOOL
// GetPointerDeviceProperties( HANDLE device, UINT32 *propertyCount, POINTER_DEVICE_PROPERTY *pointerProperties );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "dbb81637-217a-49b1-9e81-2068cf4c0951")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetPointerDeviceProperties(HANDLE device, ref uint propertyCount, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] POINTER_DEVICE_PROPERTY[] pointerProperties);
/// <summary>
/// Gets the x and y range for the pointer device (in himetric) and the x and y range (current resolution) for the display that the
/// pointer device is mapped to.
/// </summary>
/// <param name="device">The handle to the pointer device.</param>
/// <param name="pointerDeviceRect">The structure for retrieving the device's physical range data.</param>
/// <param name="displayRect">The structure for retrieving the display resolution.</param>
/// <returns>
/// TRUE if the function succeeds; otherwise, FALSE. If the function fails, call the GetLastError function for more information.
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getpointerdevicerects BOOL GetPointerDeviceRects( HANDLE
// device, RECT *pointerDeviceRect, RECT *displayRect );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "a6586dec-6d57-4345-be56-89c7308c1097")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetPointerDeviceRects(HANDLE device, out RECT pointerDeviceRect, out RECT displayRect);
/// <summary>Gets information about the pointer devices attached to the system.</summary>
/// <param name="deviceCount">
/// If pointerDevices is NULL, deviceCount returns the total number of attached pointer devices. Otherwise, deviceCount specifies the
/// number of POINTER_DEVICE_INFO structures pointed to by pointerDevices.
/// </param>
/// <param name="pointerDevices">
/// Array of POINTER_DEVICE_INFO structures for the pointer devices attached to the system. If NULL, the total number of attached
/// pointer devices is returned in deviceCount.
/// </param>
/// <returns>
/// <para>If this function succeeds, it returns TRUE.</para>
/// <para>Otherwise, it returns FALSE. To retrieve extended error information, call the GetLastError function.</para>
/// </returns>
/// <remarks>
/// <para>Windows 8 supports the following:</para>
/// <list type="bullet">
/// <item>
/// <term>256 contacts per pointer device.</term>
/// </item>
/// <item>
/// <term>
/// 2560 total contacts per system session, regardless of the number of attached devices. For example, 10 pointer devices with 256
/// contacts each, 20 pointer devices with 128 contacts each, and so on.
/// </term>
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getpointerdevices BOOL GetPointerDevices( UINT32
// *deviceCount, POINTER_DEVICE_INFO *pointerDevices );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "91FD5EBA-EDD7-4D7D-ABF3-3CE2461417B0")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetPointerDevices(ref uint deviceCount, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] POINTER_DEVICE_INFO[] pointerDevices);
/// <summary>Gets the entire frame of information for the specified pointers associated with the current message.</summary>
/// <param name="pointerId">An identifier of the pointer for which to retrieve frame information.</param>
/// <param name="pointerCount">
@ -1300,6 +1448,22 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetPointerType(uint pointerId, out POINTER_INPUT_TYPE pointerType);
/// <summary>Gets the raw input data from the pointer device.</summary>
/// <param name="pointerId">An identifier of the pointer for which to retrieve information.</param>
/// <param name="historyCount">The pointer history.</param>
/// <param name="propertiesCount">Number of properties to retrieve.</param>
/// <param name="pProperties">Array of POINTER_DEVICE_PROPERTY structures that contain raw data reported by the device.</param>
/// <param name="pValues">The values for pProperties.</param>
/// <returns>
/// TRUE if the function succeeds; otherwise, FALSE. If the function fails, call the GetLastError function for more information.
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getrawpointerdevicedata BOOL GetRawPointerDeviceData(
// UINT32 pointerId, UINT32 historyCount, UINT32 propertiesCount, POINTER_DEVICE_PROPERTY *pProperties, LONG *pValues );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "56b65cc9-9582-4c7f-81e8-0b0d45b4dc8b")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetRawPointerDeviceData(uint pointerId, uint historyCount, uint propertiesCount, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] POINTER_DEVICE_PROPERTY[] pProperties, IntPtr pValues);
/// <summary>Gets pointer data before it has gone through touch prediction processing.</summary>
/// <returns>The screen location of the pointer input.</returns>
/// <remarks>By default, touch prediction is activated.</remarks>
@ -1334,6 +1498,89 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsMouseInPointerEnabled();
/// <summary>
/// Registers a window to process the WM_POINTERDEVICECHANGE, WM_POINTERDEVICEINRANGE, and WM_POINTERDEVICEOUTOFRANGE pointer device notifications.
/// </summary>
/// <param name="window">
/// The window that receives WM_POINTERDEVICECHANGE, WM_POINTERDEVICEINRANGE, and WM_POINTERDEVICEOUTOFRANGE notifications.
/// </param>
/// <param name="notifyRange">
/// If set to TRUE, process the WM_POINTERDEVICEINRANGE and WM_POINTERDEVICEOUTOFRANGE messages. If set to FALSE, these messages
/// aren't processed.
/// </param>
/// <returns>
/// <para>If this function succeeds, it returns TRUE.</para>
/// <para>Otherwise, it returns FALSE. To retrieve extended error information, call the GetLastError function.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registerpointerdevicenotifications BOOL
// RegisterPointerDeviceNotifications( HWND window, BOOL notifyRange );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "a7322d97-f96c-449d-94a6-2081962ec7ed")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool RegisterPointerDeviceNotifications(HWND window, [MarshalAs(UnmanagedType.Bool)] bool notifyRange);
/// <summary>Allows the caller to register a target window to which all pointer input of the specified type is redirected.</summary>
/// <param name="hwnd">
/// <para>The window to register as a global redirection target.</para>
/// <para>
/// Redirection can cause the foreground window to lose activation (focus). To avoid this, ensure the window is a message-only window
/// or has the WS_EX_NOACTIVATE style set.
/// </para>
/// </param>
/// <param name="pointerType">
/// Type of pointer input to be redirected to the specified window. This is any valid and supported value from the POINTER_INPUT_TYPE
/// enumeration. Note that the generic <c>PT_POINTER</c> type and the <c>PT_MOUSE</c> type are not valid in this parameter.
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is non-zero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>
/// An application with the UI Access privilege can use this function to register its own window to receive all input of the
/// specified pointer input type. Each desktop allows only one such global redirection target window for each pointer input type at
/// any given time. The first window to successfully register remains in effect until the window is unregistered or destroyed, at
/// which point the role is available to the next qualified caller.
/// </para>
/// <para>
/// While the registration is in effect, all input of the specified pointer type, whether from an input device or injected by an
/// application, is redirected to the registered window. However, when the process that owns the registered window injects input of
/// the specified pointer type, such injected is not redirected but is instead processed normally.
/// </para>
/// <para>
/// An application that wishes to register the same window as a global redirection target for multiple pointer input types must call
/// the <c>RegisterPointerInputTarget</c> function multiple times, once for each pointer input type of interest.
/// </para>
/// <para>If the calling thread does not have the UI Access privilege, this function fails with the last error set to <c>ERROR_ACCESS_DENIED</c>.</para>
/// <para>If the specified pointer input type is not valid, this function fails with the last error set to <c>ERROR_INVALID_PARAMETER</c>.</para>
/// <para>If the calling thread does not own the specified window, this function fails with the last error set to <c>ERROR_ACCESS_DENIED</c>.</para>
/// <para>
/// If the specified windows desktop already has a registered global redirection target for the specified pointer input type, this
/// function fails with the last error set to <c>ERROR_ACCESS_DENIED</c>.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registerpointerinputtarget BOOL
// RegisterPointerInputTarget( HWND hwnd, POINTER_INPUT_TYPE pointerType );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "75faea24-91cd-448b-b67a-09fe530f1830")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool RegisterPointerInputTarget(HWND hwnd, POINTER_INPUT_TYPE pointerType);
/// <summary>
/// <para>[ <c>RegisterPointerInputTargetEx</c> is not supported and may be altered or unavailable in the future. Instead, use RegisterPointerInputTarget.]</para>
/// <para><c>RegisterPointerInputTargetEx</c> may be altered or unavailable. Instead, use RegisterPointerInputTarget.</para>
/// </summary>
/// <param name="hwnd">Not supported.</param>
/// <param name="pointerType">Not supported.</param>
/// <param name="fObserve">Not supported.</param>
/// <returns>Not supported.</returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registerpointerinputtargetex BOOL
// RegisterPointerInputTargetEx( HWND hwnd, POINTER_INPUT_TYPE pointerType, BOOL fObserve );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "E2B3D097-36E5-4444-B9DF-B3D38F1FEF48")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool RegisterPointerInputTargetEx(HWND hwnd, POINTER_INPUT_TYPE pointerType, [MarshalAs(UnmanagedType.Bool)] bool fObserve);
/// <summary>
/// Determines which pointer input frame generated the most recently retrieved message for the specified pointer and discards any
/// queued (unretrieved) pointer input messages generated from the same pointer input frame. If an application has retrieved
@ -1390,6 +1637,41 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SkipPointerFrameMessages(uint pointerId);
/// <summary>Allows the caller to unregister a target window to which all pointer input of the specified type is redirected.</summary>
/// <param name="hwnd">Window to be un-registered as a global redirection target on its desktop.</param>
/// <param name="pointerType">
/// Type of pointer input to no longer be redirected to the specified window. This is any valid and supported value from the
/// POINTER_INPUT_TYPE enumeration. Note that the generic <c>PT_POINTER</c> type and the <c>PT_MOUSE</c> type are not valid in this parameter.
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is non-zero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>
/// An application that has successfully called the RegisterPointerInputTarget function can call this function to un-register the
/// window from the role of global redirected target for the specified pointer type.
/// </para>
/// <para>
/// An application that has registered the same window as a global redirection target for multiple pointer input types can call the
/// <c>UnregisterPointerInputTarget</c> to un-register the window for one of those types while leaving the window registered for the
/// remaining types.
/// </para>
/// <para>If the calling thread does not have the UI Access privilege, this function fails with the last error set to <c>ERROR_ACCESS_DENIED</c>.</para>
/// <para>If the specified pointer input type is not valid, this function fails with the last error set to <c>ERROR_INVALID_PARAMETER</c>.</para>
/// <para>If the calling thread does not own the specified window, this function fails with the last error set to <c>ERROR_ACCESS_DENIED</c>.</para>
/// <para>
/// If the specified window is not the registered global redirection target for the specified pointer input type on its desktop, this
/// function takes no action and returns success.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-unregisterpointerinputtarget BOOL
// UnregisterPointerInputTarget( HWND hwnd, POINTER_INPUT_TYPE pointerType );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "75faea24-91cd-448b-b67a-09fe530f1800")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UnregisterPointerInputTarget(HWND hwnd, POINTER_INPUT_TYPE pointerType);
/// <summary>
/// Defines the matrix that represents a transform on a message consumer. This matrix can be used to transform pointer input data
/// from client coordinates to screen coordinates, while the inverse can be used to transform pointer input data from screen
@ -1439,6 +1721,97 @@ namespace Vanara.PInvoke
}
}
/// <summary>Contains cursor ID mappings for pointer devices.</summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-pointer_device_cursor_info typedef struct
// tagPOINTER_DEVICE_CURSOR_INFO { UINT32 cursorId; POINTER_DEVICE_CURSOR_TYPE cursor; } POINTER_DEVICE_CURSOR_INFO;
[PInvokeData("winuser.h", MSDNShortId = "5d71e5b4-95eb-453e-9164-e7659ef4059e")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINTER_DEVICE_CURSOR_INFO
{
/// <summary>The assigned cursor ID.</summary>
public uint cursorId;
/// <summary>The POINTER_DEVICE_CURSOR_TYPE that the ID is mapped to.</summary>
public POINTER_DEVICE_CURSOR_TYPE cursor;
}
/// <summary>
/// Contains information about a pointer device. An array of these structures is returned from the GetPointerDevices function. A
/// single structure is returned from a call to the GetPointerDevice function.
/// </summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-tagpointer_device_info typedef struct
// tagPOINTER_DEVICE_INFO { DWORD displayOrientation; HANDLE device; POINTER_DEVICE_TYPE pointerDeviceType; HMONITOR monitor; ULONG
// startingCursorId; USHORT maxActiveContacts; WCHAR productString[POINTER_DEVICE_PRODUCT_STRING_MAX]; } POINTER_DEVICE_INFO;
[PInvokeData("winuser.h", MSDNShortId = "1b909caf-2d69-42b9-8d60-5d89a0286f59")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINTER_DEVICE_INFO
{
/// <summary>
/// <para>One of the values from DISPLAYCONFIG_ROTATION, which identifies the orientation of the input digitizer.</para>
/// <para><c>Note</c> This value is 0 when the source of input is Touch Injection.</para>
/// </summary>
public uint displayOrientation;
/// <summary>The handle to the pointer device.</summary>
public HANDLE device;
/// <summary>The device type.</summary>
public POINTER_DEVICE_TYPE pointerDeviceType;
/// <summary>
/// The HMONITOR for the display that the device is mapped to. This is not necessarily the monitor that the pointer device is
/// physically connected to.
/// </summary>
public HMONITOR monitor;
/// <summary>The lowest ID that's assigned to the device.</summary>
public uint startingCursorId;
/// <summary>The number of supported simultaneous contacts.</summary>
public ushort maxActiveContacts;
/// <summary>The string that identifies the product.</summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 520)]
public string productString;
}
/// <summary>Contains pointer-based device properties (Human Interface Device (HID) global items that correspond to HID usages).</summary>
/// <remarks>
/// Developers can use this function to determine the properties that a device supports beyond the standard ones that are delivered
/// through Pointer Input Messages and Notifications. The properties map directly to HID usages.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-tagpointer_device_property typedef struct
// tagPOINTER_DEVICE_PROPERTY { INT32 logicalMin; INT32 logicalMax; INT32 physicalMin; INT32 physicalMax; UINT32 unit; UINT32
// unitExponent; USHORT usagePageId; USHORT usageId; } POINTER_DEVICE_PROPERTY;
[PInvokeData("winuser.h", MSDNShortId = "2c96379e-7c9f-440c-a98b-bda38bacd33f")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINTER_DEVICE_PROPERTY
{
/// <summary>The minimum value that the device can report for this property.</summary>
public int logicalMin;
/// <summary>The maximum value that the device can report for this property.</summary>
public int logicalMax;
/// <summary>The physical minimum in Himetric.</summary>
public int physicalMin;
/// <summary>The physical maximum in Himetric.</summary>
public int physicalMax;
/// <summary>The unit.</summary>
public uint unit;
/// <summary>The exponent.</summary>
public uint unitExponent;
/// <summary>The usage page for the property, as documented in the HID specification.</summary>
public ushort usagePageId;
/// <summary>The usage of the property, as documented in the HID specification.</summary>
public ushort usageId;
}
/// <summary>
/// Contains basic pointer information common to all pointer types. Applications can retrieve this information using the
/// GetPointerInfo, GetPointerFrameInfo, GetPointerInfoHistory and GetPointerFrameInfoHistory functions.

View File

@ -0,0 +1,161 @@
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class User32
{
/// <summary>Attaches or detaches the input processing mechanism of one thread to that of another thread.</summary>
/// <param name="idAttach">
/// The identifier of the thread to be attached to another thread. The thread to be attached cannot be a system thread.
/// </param>
/// <param name="idAttachTo">
/// <para>The identifier of the thread to which idAttach will be attached. This thread cannot be a system thread.</para>
/// <para>A thread cannot attach to itself. Therefore, idAttachTo cannot equal idAttach.</para>
/// </param>
/// <param name="fAttach">
/// If this parameter is <c>TRUE</c>, the two threads are attached. If the parameter is <c>FALSE</c>, the threads are detached.
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// <para>
/// <c>Windows Server 2003 and Windows XP:</c> There is no extended error information; do not call GetLastError. This behavior
/// changed as of Windows Vista.
/// </para>
/// </returns>
/// <remarks>
/// <para>
/// By using the <c>AttachThreadInput</c> function, a thread can share its input states (such as keyboard states and the current
/// focus window) with another thread. Keyboard and mouse events received by both threads are processed in the order they were
/// received until the threads are detached by calling <c>AttachThreadInput</c> a second time and specifying <c>FALSE</c> for the
/// fAttach parameter.
/// </para>
/// <para>
/// The <c>AttachThreadInput</c> function fails if either of the specified threads does not have a message queue. The system creates
/// a thread's message queue when the thread makes its first call to one of the USER or GDI functions. The <c>AttachThreadInput</c>
/// function also fails if a journal record hook is installed. Journal record hooks attach all input queues together.
/// </para>
/// <para>
/// Note that key state, which can be ascertained by calls to the GetKeyState or GetKeyboardState function, is reset after a call to
/// <c>AttachThreadInput</c>. You cannot attach a thread to a thread in another desktop.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-attachthreadinput BOOL AttachThreadInput( DWORD idAttach,
// DWORD idAttachTo, BOOL fAttach );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "0c343fab-56ae-4c70-a79e-0c5f827158a3")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, [MarshalAs(UnmanagedType.Bool)] bool fAttach);
/// <summary>
/// <para>Determines whether the process belongs to a Windows Store app.</para>
/// </summary>
/// <param name="hProcess">
/// <para>Target process handle.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-isimmersiveprocess BOOL IsImmersiveProcess( HANDLE
// hProcess );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "E95FD9C0-8E4A-44FA-BBA6-0A7F53A0E584")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsImmersiveProcess(HPROCESS hProcess);
/// <summary>
/// <para>
/// Exempts the calling process from restrictions preventing desktop processes from interacting with the Windows Store app
/// environment. This function is used by development and debugging tools.
/// </para>
/// <para>
/// This function only succeeds if a developer license is present on the system. Once successful the calling process will be able to
/// perform the following actions, subject to User Interface Privilege Isolation (UIPI) restrictions:
/// </para>
/// <list type="bullet">
/// <item>
/// <term>Attach global hooks (and event hooks) to Windows Store app processes.</term>
/// </item>
/// <item>
/// <term>
/// Attach input queues between Windows Store app processes, Windows Store app browsers, system processes, and desktop application processes.
/// </term>
/// </item>
/// <item>
/// <term>Change foreground arbitrarily between the Windows Store app and desktop environments.</term>
/// </item>
/// </list>
/// </summary>
/// <param name="fEnableExemption">When set to TRUE, indicates a request to disable exemption for the calling process.</param>
/// <returns>
/// <para>If the function succeeds, the return value is nonzero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// Any process can call this function, including desktop and Windows Store app processes and processes that use IL code.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessrestrictionexemption BOOL
// SetProcessRestrictionExemption( BOOL fEnableExemption );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "CC7EE5D7-ADFC-4859-88F8-C5C21AEBF315")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetProcessRestrictionExemption([MarshalAs(UnmanagedType.Bool)] bool fEnableExemption);
/// <summary>
/// Waits until the specified process has finished processing its initial input and is waiting for user input with no input pending,
/// or until the time-out interval has elapsed.
/// </summary>
/// <param name="hProcess">
/// A handle to the process. If this process is a console application or does not have a message queue, <c>WaitForInputIdle</c>
/// returns immediately.
/// </param>
/// <param name="dwMilliseconds">
/// The time-out interval, in milliseconds. If dwMilliseconds is INFINITE, the function does not return until the process is idle.
/// </param>
/// <returns>
/// <para>The following table shows the possible return values for this function.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term>0</term>
/// <term>The wait was satisfied successfully.</term>
/// </item>
/// <item>
/// <term>WAIT_TIMEOUT</term>
/// <term>The wait was terminated because the time-out interval elapsed.</term>
/// </item>
/// <item>
/// <term>WAIT_FAILED</term>
/// <term>An error occurred.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// The <c>WaitForInputIdle</c> function enables a thread to suspend its execution until the specified process has finished its
/// initialization and is waiting for user input with no input pending. If the process has multiple threads, the
/// <c>WaitForInputIdle</c> function returns as soon as any thread becomes idle.
/// </para>
/// <para>
/// <c>WaitForInputIdle</c> can be used at any time, not just during application startup. However, <c>WaitForInputIdle</c> waits only
/// once for a process to become idle; subsequent <c>WaitForInputIdle</c> calls return immediately, whether the process is idle or busy.
/// </para>
/// <para>
/// <c>WaitForInputIdle</c> can be useful for synchronizing a parent process and a newly created child process. When a parent process
/// creates a child process, the CreateProcess function returns without waiting for the child process to finish its initialization.
/// Before trying to communicate with the child process, the parent process can use the <c>WaitForInputIdle</c> function to determine
/// when the child's initialization has been completed. For example, the parent process should use the <c>WaitForInputIdle</c>
/// function before trying to find a window associated with the child process.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-waitforinputidle DWORD WaitForInputIdle( HANDLE hProcess,
// DWORD dwMilliseconds );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "2a684921-36f1-438c-895c-5bebc242635a")]
public static extern uint WaitForInputIdle(HPROCESS hProcess, uint dwMilliseconds);
}
}

View File

@ -3706,6 +3706,15 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool LockWorkStation();
/// <summary>Returns strings for standard message box buttons.</summary>
/// <param name="wBtn">The id of the string to return. These are identified by the Dialog Box Command ID values listed in winuser.h.</param>
/// <returns>The string, or NULL if not found.</returns>
// https://docs.microsoft.com/en-us/windows/desktop/dlgbox/mb-getstring LPCWSTR WINAPI MB_GetString( UINT wBtn );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("", MSDNShortId = "D2AF238D-F5A8-477D-BF47-0F5D4D68B27E")]
[return: MarshalAs(UnmanagedType.LPWStr)]
public static extern string MB_GetString(uint wBtn);
/// <summary>
/// <para>Plays a waveform sound. The waveform sound for each sound type is identified by an entry in the registry.</para>
/// </summary>

View File

@ -53,6 +53,24 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool KillTimer([Optional] HWND hWnd, IntPtr uIDEvent);
/// <summary>Creates a timer with the specified time-out value and coalescing tolerance delay.</summary>
/// <param name="hWnd"><para>Type: <c>HWND</c></para><para>A handle to the window to be associated with the timer. This window must be owned by the calling thread. If a <c>NULL</c> value for hWnd is passed in along with an nIDEvent of an existing timer, that timer will be replaced in the same way that an existing non-NULL hWnd timer will be.</para></param>
/// <param name="nIDEvent"><para>Type: <c>UINT_PTR</c></para><para>A timer identifier. If the hWnd parameter is <c>NULL</c>, and the nIDEvent does not match an existing timer, then the nIDEvent is ignored and a new timer ID is generated. If the hWnd parameter is not <c>NULL</c> and the window specified by hWnd already has a timer with the value nIDEvent, then the existing timer is replaced by the new timer. When <c>SetCoalescableTimer</c> replaces a timer, the timer is reset. Therefore, a message will be sent after the current time-out value elapses, but the previously set time-out value is ignored. If the call is not intended to replace an existing timer, nIDEvent should be 0 if the hWnd is <c>NULL</c>.</para></param>
/// <param name="uElapse"><para>Type: <c>UINT</c></para><para>The time-out value, in milliseconds.</para><para>If uElapse is less than <c>USER_TIMER_MINIMUM</c> (0x0000000A), the timeout is set to <c>USER_TIMER_MINIMUM</c>. If uElapse is greater than <c>USER_TIMER_MAXIMUM</c> (0x7FFFFFFF), the timeout is set to <c>USER_TIMER_MAXIMUM</c>.</para><para>If the sum of uElapse and uToleranceDelay exceeds <c>USER_TIMER_MAXIMUM</c>, an ERROR_INVALID_PARAMETER exception occurs.</para></param>
/// <param name="lpTimerFunc"><para>Type: <c>TIMERPROC</c></para><para>A pointer to the function to be notified when the time-out value elapses. For more information about the function, see TimerProc. If lpTimerFunc is <c>NULL</c>, the system posts a WM_TIMER message to the application queue. The <c>hwnd</c> member of the message's MSG structure contains the value of the hWnd parameter.</para></param>
/// <param name="uToleranceDelay"><para>Type: <c>ULONG</c></para><para>It can be one of the following values:</para><list type="table"><listheader><term>Value</term><term>Meaning</term></listheader><item><term> TIMERV_DEFAULT_COALESCING 0x00000000 </term><term>Uses the system default timer coalescing.</term></item><item><term> TIMERV_NO_COALESCING 0xFFFFFFFF </term><term> Uses no timer coalescing. When this value is used, the created timer is not coalesced, no matter what the system default timer coalescing is or the application compatiblity flags are. </term></item><item><term> 0x1 - 0x7FFFFFF5 </term><term> Specifies the coalescing tolerance delay, in milliseconds. Applications should set this value to the system default (TIMERV_DEFAULT_COALESCING) or the largest value possible. If the sum of uElapse and uToleranceDelay exceeds USER_TIMER_MAXIMUM (0x7FFFFFFF), an ERROR_INVALID_PARAMETER exception occurs. See Windows Timer Coalescing for more details and best practices.</term></item><item><term> Any other value </term><term> An invalid value. If uToleranceDelay is set to an invalid value, the function fails and returns zero. </term></item></list></param>
/// <returns>
/// <para>Type: <c>Type: <c>UINT_PTR</c> </c></para><para>If the function succeeds and the hWnd parameter is <c>NULL</c>, the return value is an integer identifying the new timer. An application can pass this value to the KillTimer function to destroy the timer.</para><para>If the function succeeds and the hWnd parameter is not <c>NULL</c>, then the return value is a nonzero integer. An application can pass the value of the nIDEvent parameter to the KillTimer function to destroy the timer.</para><para>If the function fails to create a timer, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>An application can process WM_TIMER messages by including a <c>WM_TIMER</c> case statement in the window procedure or by specifying a TimerProc callback function when creating the timer. When you specify a <c>TimerProc</c> callback function, the default window procedure calls the callback function when it processes <c>WM_TIMER</c>. Therefore, you need to dispatch messages in the calling thread, even when you use <c>TimerProc</c> instead of processing <c>WM_TIMER</c>.</para><para>The wParam parameter of the WM_TIMER message contains the value of the nIDEvent parameter.</para><para>The timer identifier, nIDEvent, is specific to the associated window. Another window can have its own timer which has the same identifier as a timer owned by another window. The timers are distinct.</para><para>SetTimer can reuse timer IDs in the case where hWnd is <c>NULL</c>.</para><para>When uToleranceDelay is set to 0, the system default timer coalescing is used and <c>SetCoalescableTimer</c> behaves the same as SetTimer.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setcoalescabletimer
// UINT_PTR SetCoalescableTimer( HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, ULONG uToleranceDelay );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "39303811-972f-4131-deea-cebf84c50867")]
public static extern UIntPtr SetCoalescableTimer(HWND hWnd, UIntPtr nIDEvent, uint uElapse, Timerproc lpTimerFunc, uint uToleranceDelay);
/// <summary>Creates a timer with the specified time-out value.</summary>
/// <param name="hWnd">
/// <para>Type: <c>HWND</c></para>

View File

@ -97,6 +97,34 @@ namespace Vanara.PInvoke
GID_ROLLOVER = GID_PRESSANDTAP,
}
/// <summary> Flags for <see cref="InitializeTouchInjection/>. </summary>
[PInvokeData("winuser.h", MSDNShortId = "79cc2a05-d8ee-4d87-9c7b-fa7d5354b04f")]
public enum TOUCH_FEEDBACK
{
/// <summary>Specifies default touch visualizations.</summary>
TOUCH_FEEDBACK_DEFAULT = 0x1,
/// <summary>Specifies indirect touch visualizations.</summary>
TOUCH_FEEDBACK_INDIRECT = 0x2,
/// <summary>Specifies no touch visualizations.</summary>
TOUCH_FEEDBACK_NONE = 0x3,
}
/// <summary>Flags for <see cref="RegisterTouchHitTestingWindow"/></summary>
[PInvokeData("winuser.h", MSDNShortId = "52e48cea-b5c7-405f-8df6-26052304b62c")]
public enum TOUCH_HIT_TESTING
{
/// <summary>The touch hit testing default</summary>
TOUCH_HIT_TESTING_DEFAULT = 0x0,
/// <summary>The touch hit testing client</summary>
TOUCH_HIT_TESTING_CLIENT = 0x1,
/// <summary>The touch hit testing none</summary>
TOUCH_HIT_TESTING_NONE = 0x2
}
/// <summary>Flags used by <see cref="TOUCHINPUT"/>.</summary>
[PInvokeData("winuser.h", MSDNShortId = "fc382759-3a1e-401e-a6a7-1bf209a5434b")]
[Flags]
@ -212,6 +240,101 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool CloseTouchInputHandle(HTOUCHINPUT hTouchInput);
/// <summary>
/// Returns the score of a polygon as the probable touch target (compared to all other polygons that intersect the touch contact
/// area) and an adjusted touch point within the polygon.
/// </summary>
/// <param name="numVertices">
/// <para>The number of vertices in the polygon. This value must be greater than or equal to 3.</para>
/// <para>This value indicates the size of the array, as specified by the controlPolygon parameter.</para>
/// </param>
/// <param name="controlPolygon">
/// <para>The array of x-y screen coordinates that define the shape of the UI element.</para>
/// <para>The numVertices parameter specifies the number of coordinates.</para>
/// </param>
/// <param name="pHitTestingInput">The TOUCH_HIT_TESTING_INPUT structure that holds the data for the touch contact area.</param>
/// <param name="pProximityEval">
/// The TOUCH_HIT_TESTING_PROXIMITY_EVALUATION structure that holds the score and adjusted touch-point data.
/// </param>
/// <returns>
/// <para>If this function succeeds, it returns TRUE.</para>
/// <para>Otherwise, it returns FALSE. To retrieve extended error information, call the GetLastError function.</para>
/// </returns>
/// <remarks>
/// <para>For consistency with Windows, frameworks that handle WM_TOUCHHITTESTING should use the following principles for targeting:</para>
/// <list type="bullet">
/// <item>
/// <term>Inclusion: If the touch point is within the boundaries of a control, the touch point is not changed.</term>
/// </item>
/// <item>
/// <term>Intersection: Include only controls that intersect the contact geometry.</term>
/// </item>
/// <item>
/// <term>
/// Z-order: If more than one control intersects the contact geometry, and the controls overlap, the control that's highest in the
/// z-order receives priority.
/// </term>
/// </item>
/// <item>
/// <term>
/// Ambiguity: If more than one control intersects the contact geometry, and the controls don't overlap, the control that's closest
/// to the original touch point receives priority.
/// </term>
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-evaluateproximitytopolygon BOOL
// EvaluateProximityToPolygon( UINT32 numVertices, const POINT *controlPolygon, const TOUCH_HIT_TESTING_INPUT *pHitTestingInput,
// TOUCH_HIT_TESTING_PROXIMITY_EVALUATION *pProximityEval );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "443d12f2-9f26-4e1e-9bf3-cd97b4026399")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EvaluateProximityToPolygon(uint numVertices, [In] System.Drawing.Point[] controlPolygon, in TOUCH_HIT_TESTING_INPUT pHitTestingInput, out TOUCH_HIT_TESTING_PROXIMITY_EVALUATION pProximityEval);
/// <summary>
/// Returns the score of a rectangle as the probable touch target, compared to all other rectangles that intersect the touch contact
/// area, and an adjusted touch point within the rectangle.
/// </summary>
/// <param name="controlBoundingBox">The RECT structure that defines the bounding box of the UI element.</param>
/// <param name="pHitTestingInput">The TOUCH_HIT_TESTING_INPUT structure that holds the data for the touch contact area.</param>
/// <param name="pProximityEval">
/// The TOUCH_HIT_TESTING_PROXIMITY_EVALUATION structure that holds the score and adjusted touch-point data.
/// </param>
/// <returns>
/// <para>If this function succeeds, it returns TRUE.</para>
/// <para>Otherwise, it returns FALSE. To retrieve extended error information, call the GetLastError function.</para>
/// </returns>
/// <remarks>
/// <para>For consistency with Windows, frameworks that handle WM_TOUCHHITTESTING should use the following principles for targeting:</para>
/// <list type="bullet">
/// <item>
/// <term>Inclusion: If the touch point is within the boundaries of a control, the touch point is not changed.</term>
/// </item>
/// <item>
/// <term>Intersection: Include only controls that intersect the contact geometry.</term>
/// </item>
/// <item>
/// <term>
/// Z-order: If more than one control intersects the contact geometry, and the controls overlap, the control that's highest in the
/// z-order receives priority.
/// </term>
/// </item>
/// <item>
/// <term>
/// Ambiguity: If more than one control intersects the contact geometry, and the controls don't overlap, the control that's closest
/// to the original touch point receives priority.
/// </term>
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-evaluateproximitytorect BOOL EvaluateProximityToRect(
// const RECT *controlBoundingBox, const TOUCH_HIT_TESTING_INPUT *pHitTestingInput, TOUCH_HIT_TESTING_PROXIMITY_EVALUATION
// *pProximityEval );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "269ef4c1-9c9f-4bd7-9852-e82c4a707d3c")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EvaluateProximityToRect(in RECT controlBoundingBox, in TOUCH_HIT_TESTING_INPUT pHitTestingInput, out TOUCH_HIT_TESTING_PROXIMITY_EVALUATION pProximityEval);
/// <summary>Retrieves the configuration for which Windows Touch gesture messages are sent from a window.</summary>
/// <param name="hwnd">A handle to the window to get the gesture configuration from.</param>
/// <param name="dwReserved">This value is reserved and must be set to 0.</param>
@ -351,6 +474,152 @@ namespace Vanara.PInvoke
[PInvokeData("winuser.h", MSDNShortId = "058c914e-82c7-40f9-8d0d-2a6a8e77cee0")]
public static ushort GID_ROTATE_ANGLE_TO_ARGUMENT(double arg) => (ushort)((arg + 2.0 * Math.PI) / (4.0 * Math.PI) * ushort.MaxValue);
/// <summary>
/// Configures the touch injection context for the calling application and initializes the maximum number of simultaneous contacts
/// that the app can inject.
/// </summary>
/// <param name="maxCount">
/// <para>The maximum number of touch contacts.</para>
/// <para>The maxCount parameter must be greater than 0 and less than or equal to MAX_TOUCH_COUNT (256) as defined in winuser.h.</para>
/// </param>
/// <param name="dwMode">
/// <para>The contact visualization mode.</para>
/// <para>The dwMode parameter must be TOUCH_FEEDBACK_DEFAULT, <c>TOUCH_FEEDBACK_INDIRECT</c>, or <c>TOUCH_FEEDBACK_NONE</c>.</para>
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is TRUE.</para>
/// <para>If the function fails, the return value is FALSE. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>
/// If TOUCH_FEEDBACK_DEFAULT is set, the injected touch feedback may get suppressed by the end-user settings in the <c>Pen and
/// Touch</c> control panel.
/// </para>
/// <para>
/// If TOUCH_FEEDBACK_INDIRECT is set, the injected touch feedback overrides the end-user settings in the <c>Pen and Touch</c>
/// control panel.
/// </para>
/// <para>
/// If TOUCH_FEEDBACK_INDIRECT or <c>TOUCH_FEEDBACK_NONE</c> are set, touch feedback provided by applications and controls may not be affected.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-initializetouchinjection BOOL InitializeTouchInjection(
// UINT32 maxCount, DWORD dwMode );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "79cc2a05-d8ee-4d87-9c7b-fa7d5354b04f")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool InitializeTouchInjection(uint maxCount, TOUCH_FEEDBACK dwMode);
/// <summary>Simulates touch input.</summary>
/// <param name="count">
/// <para>The size of the array in contacts.</para>
/// <para>The maximum value for count is specified by the maxCount parameter of the InitializeTouchInjection function.</para>
/// </param>
/// <param name="contacts">
/// Array of POINTER_TOUCH_INFO structures that represents all contacts on the desktop. The screen coordinates of each contact must
/// be within the bounds of the desktop.
/// </param>
/// <returns>
/// <para>If the function succeeds, the return value is non-zero.</para>
/// <para>If the function fails, the return value is zero. To get extended error information, call GetLastError.</para>
/// </returns>
/// <remarks>
/// <para>The injected input is sent to the desktop of the session where the injection process is running.</para>
/// <para>
/// There are two input states for touch input injection (interactive and hover) that are indicated by the following combinations of
/// <c>pointerFlags</c> in contacts:
/// </para>
/// <list type="table">
/// <listheader>
/// <term>pointerFlags (POINTER_FLAG_*)</term>
/// <term>Status</term>
/// </listheader>
/// <item>
/// <term>INRANGE | UPDATE</term>
/// <term>Touch hover starts or moves</term>
/// </item>
/// <item>
/// <term>INRANGE | INCONTACT | DOWN</term>
/// <term>Touch contact down</term>
/// </item>
/// <item>
/// <term>INRANGE | INCONTACT | UPDATE</term>
/// <term>Touch contact moves</term>
/// </item>
/// <item>
/// <term>INRANGE | UP</term>
/// <term>Touch contact up and transition to hover</term>
/// </item>
/// <item>
/// <term>UPDATE</term>
/// <term>Touch hover ends</term>
/// </item>
/// <item>
/// <term>UP</term>
/// <term>Touch ends</term>
/// </item>
/// </list>
/// <para>
/// <c>Note</c> Interactive state represents a touch contact that is on-screen and able to interact with any touch-capable app. Hover
/// state represents touch input that is not in contact with the screen and cannot interact with applications. Touch injection can
/// start in hover or interactive state, but the state can only transition through INRANGE | INCONTACT | DOWN for hover to
/// interactive state, or through INRANGE | UP for interactive to hover state.
/// </para>
/// <para>All touch injection sequences end with either UPDATE or UP.</para>
/// <para>
/// The following diagram demonstrates a touch injection sequence that starts with a hover state, transitions to interactive, and
/// concludes with hover.
/// </para>
/// <para>
/// For press and hold gestures, multiple frames must be sent to ensure input is not cancelled. For a press and hold at point (x,y),
/// send WM_POINTERDOWN at point (x,y) followed by WM_POINTERUPDATE messages at point(x,y).
/// </para>
/// <para>
/// Listen for WM_DISPLAYCHANGE to handle changes to display resolution and orientation and manage screen coordinate updates. All
/// active contacts are cancelled when a <c>WM_DISPLAYCHANGE</c> is received.
/// </para>
/// <para>
/// Cancel individual contacts by setting POINTER_FLAG_CANCELED with POINTER_FLAG_UP or POINTER_FLAG_UPDATE. Cancelling touch
/// injection without POINTER_FLAG_UP or POINTER_FLAG_UPDATE invalidates the injection.
/// </para>
/// <para>
/// When POINTER_FLAG_UP is set, ptPixelLocation of POINTER_INFO should be the same as the value of the previous touch injection
/// frame with POINTER_FLAG_UPDATE. Otherwise, the injection fails with ERROR_INVALID_PARAMETER and all active injection contacts are
/// cancelled. The system modifies the ptPixelLocation of the WM_POINTERUP event as it cancels the injection.
/// </para>
/// <para>
/// The input timestamp can be specified in either the dwTime or PerformanceCount field of POINTER_INFO. The value cannot be more
/// recent than the current tick count or QueryPerformanceCounter value of the injection thread. Once a frame is injected with a
/// timestamp, all subsequent frames must include a timestamp until all contacts in the frame go to the UP state. The custom
/// timestamp value must be provided for the first element in the contacts array. The timestamp values after the first element are
/// ignored. The custom timestamp value must increment in every injection frame.
/// </para>
/// <para>
/// When a PerformanceCount field is specified, the timestamp is converted into current time in .1 millisecond resolution upon actual
/// injection. If a custom PerformanceCount resulted in the same .1 millisecond window from previous injection, the API will return
/// an error (ERROR_NOT_READY) and will not inject the data. While injection is not immediately invalidated by the error, next
/// successful injection must have PerformanceCount value that is at least 0.1 milliseconds apart from the previously successful
/// injection. Similarly a custom dwTime value must be at least 1 millisecond apart if the field was used.
/// </para>
/// <para>
/// If both dwTime and PerformanceCount are specified in the injection parameter, InjectTouchInput fails with an Error Code
/// (ERROR_INVALID_PARAMETER). Once the injection application starts with either a dwTime or PerformanceCount parameter, the
/// timestamp field must be filled correctly. Injection cannot switch the custom timestamp field from one to another once the
/// injection sequence has started.
/// </para>
/// <para>
/// When neither dwTime or PerformanceCount values are specified, the InjectTouchInput allocates the timestamp based on the timing of
/// the API call. If the calls are less than 0.1 millisecond apart, the API may return an error (ERROR_NOT_READY). The error will not
/// invalidate the input immediately, but the injection application needs to retry the same frame again to ensure injection is successful.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-injecttouchinput BOOL InjectTouchInput( UINT32 count,
// const POINTER_TOUCH_INFO *contacts );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "c3c1425e-2af6-4ecb-a0b2-a456654f7a53")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool InjectTouchInput(uint count, [In] POINTER_TOUCH_INFO[] contacts);
/// <summary>
/// Checks whether a specified window is touch-capable and, optionally, retrieves the modifier flags set for the window's touch capability.
/// </summary>
@ -393,6 +662,58 @@ namespace Vanara.PInvoke
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsTouchWindow(HWND hwnd, out TWF pulFlags);
/// <summary>
/// Returns the proximity evaluation score and the adjusted touch-point coordinates as a packed value for the WM_TOUCHHITTESTING callback.
/// </summary>
/// <param name="pHitTestingInput">The TOUCH_HIT_TESTING_INPUT structure that holds the data for the touch contact area.</param>
/// <param name="pProximityEval">
/// The TOUCH_HIT_TESTING_PROXIMITY_EVALUATION structure that holds the score and adjusted touch-point data that the
/// EvaluateProximityToPolygon or EvaluateProximityToRect function returns.
/// </param>
/// <returns>
/// If this function succeeds, it returns the <c>score</c> and <c>adjustedPoint</c> values from
/// TOUCH_HIT_TESTING_PROXIMITY_EVALUATION as an LRESULT. To retrieve extended error information, call the GetLastError function.
/// </returns>
/// <remarks>Usually, this is the last function that's called in a WM_TOUCHHITTESTING handler.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-packtouchhittestingproximityevaluation LRESULT
// PackTouchHitTestingProximityEvaluation( const TOUCH_HIT_TESTING_INPUT *pHitTestingInput, const
// TOUCH_HIT_TESTING_PROXIMITY_EVALUATION *pProximityEval );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "c4061285-2d0f-4404-9b63-bda2ec61b764")]
public static extern IntPtr PackTouchHitTestingProximityEvaluation(in TOUCH_HIT_TESTING_INPUT pHitTestingInput, out TOUCH_HIT_TESTING_PROXIMITY_EVALUATION pProximityEval);
/// <summary>
/// <para>Registers a window to process the</para>
/// <para>WM_TOUCHHITTESTING notification.</para>
/// </summary>
/// <param name="hwnd">The window that receives the WM_TOUCHHITTESTING notification.</param>
/// <param name="value">
/// <para>One of the following values:</para>
/// <list type="bullet">
/// <item>
/// <term>TOUCH_HIT_TESTING_CLIENT: Send WM_TOUCHHITTESTING messages to the target window.</term>
/// </item>
/// <item>
/// <term>
/// TOUCH_HIT_TESTING_DEFAULT: Don't send WM_TOUCHHITTESTING messages to the target window but continue to send the messages to child windows.
/// </term>
/// </item>
/// <item>
/// <term>TOUCH_HIT_TESTING_NONE: Don't send WM_TOUCHHITTESTING messages to the target window or child windows.</term>
/// </item>
/// </list>
/// </param>
/// <returns>
/// <para>If this function succeeds, it returns TRUE.</para>
/// <para>Otherwise, it returns FALSE. To retrieve extended error information, call the GetLastError function.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registertouchhittestingwindow BOOL
// RegisterTouchHitTestingWindow( HWND hwnd, ULONG value );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "52e48cea-b5c7-405f-8df6-26052304b62c")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool RegisterTouchHitTestingWindow(HWND hwnd, TOUCH_HIT_TESTING value);
/// <summary>Registers a window as being touch-capable.</summary>
/// <param name="hwnd">
/// The handle of the window being registered. The function fails with <c>ERROR_ACCESS_DENIED</c> if the calling thread does not own
@ -1102,6 +1423,58 @@ namespace Vanara.PInvoke
public IntPtr DangerousGetHandle() => handle;
}
/// <summary>Contains information about the touch contact area reported by the touch digitizer.</summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-touch_hit_testing_input typedef struct
// tagTOUCH_HIT_TESTING_INPUT { UINT32 pointerId; POINT point; RECT boundingBox; RECT nonOccludedBoundingBox; UINT32 orientation; }
// TOUCH_HIT_TESTING_INPUT, *PTOUCH_HIT_TESTING_INPUT;
[PInvokeData("winuser.h", MSDNShortId = "d2103f6e-6aa9-4260-bef9-cfcbec35e675")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct TOUCH_HIT_TESTING_INPUT
{
/// <summary>
/// The ID of the pointer. You cannot pass this value to the input message process and retrieve additional pointer info through GetPointerInfo.
/// </summary>
public uint pointerId;
/// <summary>The screen coordinates of the touch point that the touch digitizer reports.</summary>
public System.Drawing.Point point;
/// <summary>
/// <para>
/// The bounding rectangle of the touch contact area. Valid touch targets are identified and scored based on this bounding box.
/// </para>
/// <para><c>Note</c> This bounding box may differ from the contact area that the digitizer reports when:</para>
/// </summary>
public RECT boundingBox;
/// <summary>
/// The touch contact area within a specific targeted window that's not occluded by other objects that are higher in the z-order.
/// Any area that's occluded by another object is an invalid target.
/// </summary>
public RECT nonOccludedBoundingBox;
/// <summary>The orientation of the touch contact area.</summary>
public uint orientation;
}
/// <summary>
/// Contains the hit test score that indicates whether the object is the likely target of the touch contact area, relative to other
/// objects that intersect the touch contact area.
/// </summary>
/// <remarks>The EvaluateProximityToRect or EvaluateProximityToPolygon function returns the values.</remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-touch_hit_testing_proximity_evaluation typedef struct
// tagTOUCH_HIT_TESTING_PROXIMITY_EVALUATION { UINT16 score; POINT adjustedPoint; } TOUCH_HIT_TESTING_PROXIMITY_EVALUATION, *PTOUCH_HIT_TESTING_PROXIMITY_EVALUATION;
[PInvokeData("winuser.h", MSDNShortId = "a26facc3-fe63-4657-9bd6-821dd89cb11d")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct TOUCH_HIT_TESTING_PROXIMITY_EVALUATION
{
/// <summary>The score, compared to the other objects that intersect the touch contact area.</summary>
public ushort score;
/// <summary>The adjusted touch point that hits the closest object that's identified by the value of Score.</summary>
public System.Drawing.Point adjustedPoint;
}
/// <summary>Encapsulates data for touch input.</summary>
/// <remarks>
/// <para>The following table lists the flags for the <c>dwFlags</c> member.</para>

227
PInvoke/User32/WinUser.cs Normal file
View File

@ -0,0 +1,227 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using Vanara.InteropServices;
namespace Vanara.PInvoke
{
public static partial class User32
{
/// <summary>
/// <para>
/// Indicates the state of screen auto-rotation for the system. For example, whether auto-rotation is supported, and whether it is
/// enabled by the user. This enum is a bitwise OR of one or more of the following values.
/// </para>
/// </summary>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ne-winuser-ar_state typedef enum tagAR_STATE { AR_ENABLED,
// AR_DISABLED, AR_SUPPRESSED, AR_REMOTESESSION, AR_MULTIMON, AR_NOSENSOR, AR_NOT_SUPPORTED, AR_DOCKED, AR_LAPTOP } AR_STATE, *PAR_STATE;
[PInvokeData("winuser.h", MSDNShortId = "55BCB2EB-524D-478A-8DCE-53E59DD0822D")]
[Flags]
public enum AR_STATE
{
/// <summary>Auto-rotation is enabled by the user.</summary>
AR_ENABLED = 0x00,
/// <summary>Auto-rotation is disabled by the user.</summary>
AR_DISABLED = 0x01,
/// <summary>Auto-rotation is currently suppressed by one or more process auto-rotation preferences.</summary>
AR_SUPPRESSED = 0x02,
/// <summary>The session is remote, and auto-rotation is temporarily disabled as a result.</summary>
AR_REMOTESESSION = 0x04,
/// <summary>The system has multiple monitors attached, and auto-rotation is temporarily disabled as a result.</summary>
AR_MULTIMON = 0x08,
/// <summary>The system does not have an auto-rotation sensor.</summary>
AR_NOSENSOR = 0x10,
/// <summary>Auto-rotation is not supported with the current system configuration.</summary>
AR_NOT_SUPPORTED = 0x20,
/// <summary>The device is docked, and auto-rotation is temporarily disabled as a result.</summary>
AR_DOCKED = 0x40,
/// <summary>The device is in laptop mode, and auto-rotation is temporarily disabled as a result.</summary>
AR_LAPTOP = 0x80,
}
/// <summary>
/// <para>Translates a string into the OEM-defined character set.</para>
/// <para><c>Warning</c> Do not use. See Security Considerations.</para>
/// </summary>
/// <param name="pSrc">
/// <para>Type: <c>LPCTSTR</c></para>
/// <para>The null-terminated string to be translated.</para>
/// </param>
/// <param name="pDst">
/// <para>Type: <c>LPSTR</c></para>
/// <para>
/// The destination buffer, which receives the translated string. If the <c>CharToOem</c> function is being used as an ANSI function,
/// the string can be translated in place by setting the lpszDst parameter to the same address as the lpszSrc parameter. This cannot
/// be done if <c>CharToOem</c> is being used as a wide-character function.
/// </para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>
/// The return value is always nonzero except when you pass the same address to lpszSrc and lpszDst in the wide-character version of
/// the function. In this case the function returns zero and GetLastError returns <c>ERROR_INVALID_ADDRESS</c>.
/// </para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-chartooema BOOL CharToOemA( LPCSTR pSrc, LPSTR pDst );
[DllImport(Lib.User32, SetLastError = true, CharSet = CharSet.Auto)]
[PInvokeData("winuser.h", MSDNShortId = "")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool CharToOem(string pSrc, StringBuilder pDst);
/// <summary>Translates a specified number of characters in a string into the OEM-defined character set.</summary>
/// <param name="lpszSrc">
/// <para>Type: <c>LPCTSTR</c></para>
/// <para>The null-terminated string to be translated.</para>
/// </param>
/// <param name="lpszDst">
/// <para>Type: <c>LPSTR</c></para>
/// <para>
/// The buffer for the translated string. If the <c>CharToOemBuff</c> function is being used as an ANSI function, the string can be
/// translated in place by setting the lpszDst parameter to the same address as the lpszSrc parameter. This cannot be done if
/// <c>CharToOemBuff</c> is being used as a wide-character function.
/// </para>
/// </param>
/// <param name="cchDstLength">
/// <para>Type: <c>DWORD</c></para>
/// <para>The number of characters to translate in the string identified by the lpszSrc parameter.</para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>
/// The return value is always nonzero except when you pass the same address to lpszSrc and lpszDst in the wide-character version of
/// the function. In this case the function returns zero and GetLastError returns <c>ERROR_INVALID_ADDRESS</c>.
/// </para>
/// </returns>
/// <remarks>
/// Unlike the CharToOem function, the <c>CharToOemBuff</c> function does not stop converting characters when it encounters a null
/// character in the buffer pointed to by lpszSrc. The <c>CharToOemBuff</c> function converts all cchDstLength characters.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-chartooembuffa BOOL CharToOemBuffA( LPCSTR lpszSrc, LPSTR
// lpszDst, DWORD cchDstLength );
[DllImport(Lib.User32, SetLastError = true, CharSet = CharSet.Auto)]
[PInvokeData("winuser.h", MSDNShortId = "")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool CharToOemBuff(string lpszSrc, StringBuilder lpszDst, uint cchDstLength);
/// <summary>
/// Retrieves an AR_STATE value containing the state of screen auto-rotation for the system, for example whether auto-rotation is
/// supported, and whether it is enabled by the user. <c>GetAutoRotationState</c> provides a robust and diverse way of querying for
/// auto-rotation state, and more. For example, if you want your app to behave differently when multiple monitors are attached then
/// you can determine that from the <c>AR_STATE</c> returned.
/// </summary>
/// <param name="pState">Pointer to a location in memory that will receive the current state of auto-rotation for the system.</param>
/// <returns>
/// <para>TRUE if the method succeeds, otherwise FALSE.</para>
/// <para>See GetDisplayAutoRotationPreferences for an example of using this function.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getautorotationstate BOOL GetAutoRotationState( PAR_STATE
// pState );
[DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "E041717B-920E-44F8-AC7F-B30CB82F1476")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetAutoRotationState(out AR_STATE pState);
/// <summary>
/// <para>Translates a string from the OEM-defined character set into either an ANSI or a wide-character string.</para>
/// <para><c>Warning</c> Do not use. See Security Considerations.</para>
/// </summary>
/// <param name="pSrc">
/// <para>Type: <c>LPCSTR</c></para>
/// <para>A null-terminated string of characters from the OEM-defined character set.</para>
/// </param>
/// <param name="pDst">
/// <para>Type: <c>LPTSTR</c></para>
/// <para>
/// The destination buffer, which receives the translated string. If the <c>OemToChar</c> function is being used as an ANSI function,
/// the string can be translated in place by setting the lpszDst parameter to the same address as the lpszSrc parameter. This cannot
/// be done if <c>OemToChar</c> is being used as a wide-character function.
/// </para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>
/// The return value is always nonzero except when you pass the same address to lpszSrc and lpszDst in the wide-character version of
/// the function. In this case the function returns zero and GetLastError returns <c>ERROR_INVALID_ADDRESS</c>.
/// </para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-oemtochara BOOL OemToCharA( LPCSTR pSrc, LPSTR pDst );
[DllImport(Lib.User32, SetLastError = true, CharSet = CharSet.Auto)]
[PInvokeData("winuser.h", MSDNShortId = "")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool OemToChar(string pSrc, StringBuilder pDst);
/// <summary>
/// Translates a specified number of characters in a string from the OEM-defined character set into either an ANSI or a
/// wide-character string.
/// </summary>
/// <param name="lpszSrc">
/// <para>Type: <c>LPCSTR</c></para>
/// <para>One or more characters from the OEM-defined character set.</para>
/// </param>
/// <param name="lpszDst">
/// <para>Type: <c>LPTSTR</c></para>
/// <para>
/// The destination buffer, which receives the translated string. If the <c>OemToCharBuff</c> function is being used as an ANSI
/// function, the string can be translated in place by setting the lpszDst parameter to the same address as the lpszSrc parameter.
/// This cannot be done if the <c>OemToCharBuff</c> function is being used as a wide-character function.
/// </para>
/// </param>
/// <param name="cchDstLength">
/// <para>Type: <c>DWORD</c></para>
/// <para>The number of characters to be translated in the buffer identified by the lpszSrc parameter.</para>
/// </param>
/// <returns>
/// <para>Type: <c>BOOL</c></para>
/// <para>
/// The return value is always nonzero except when you pass the same address to lpszSrc and lpszDst in the wide-character version of
/// the function. In this case the function returns zero and GetLastError returns <c>ERROR_INVALID_ADDRESS</c>.
/// </para>
/// </returns>
/// <remarks>
/// Unlike the OemToChar function, the <c>OemToCharBuff</c> function does not stop converting characters when it encounters a null
/// character in the buffer pointed to by lpszSrc. The <c>OemToCharBuff</c> function converts all cchDstLength characters.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-oemtocharbuffa BOOL OemToCharBuffA( LPCSTR lpszSrc, LPSTR
// lpszDst, DWORD cchDstLength );
[DllImport(Lib.User32, SetLastError = true, CharSet = CharSet.Auto)]
[PInvokeData("winuser.h", MSDNShortId = "")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool OemToCharBuff(string lpszSrc, StringBuilder lpszDst, uint cchDstLength);
/// <summary>
/// <para>Sets the last-error code.</para>
/// <para>Currently, this function is identical to the SetLastError function. The second parameter is ignored.</para>
/// </summary>
/// <param name="dwErrCode">The last-error code for the thread.</param>
/// <param name="dwType">This parameter is ignored.</param>
/// <remarks>
/// <para>The last-error code is kept in thread local storage so that multiple threads do not overwrite each other's values.</para>
/// <para>
/// Most functions call SetLastError or <c>SetLastErrorEx</c> only when they fail. However, some system functions call
/// <c>SetLastError</c> or <c>SetLastErrorEx</c> under conditions of success; those cases are noted in each function's documentation.
/// </para>
/// <para>
/// Applications can optionally retrieve the value set by this function by using the GetLastError function immediately after a
/// function fails.
/// </para>
/// <para>
/// Error codes are 32-bit values (bit 31 is the most significant bit). Bit 29 is reserved for application-defined error codes; no
/// system error code has this bit set. If you are defining an error code for your application, set this bit to indicate that the
/// error code has been defined by the application and to ensure that your error code does not conflict with any system-defined error codes.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setlasterrorex void SetLastErrorEx( DWORD dwErrCode, DWORD
// dwType );
[DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)]
[PInvokeData("winuser.h", MSDNShortId = "d97494db-868a-49d4-a613-e8beba86d4e6")]
public static extern void SetLastErrorEx(uint dwErrCode, uint dwType = 0);
}
}