Skip to content
This repository was archived by the owner on Jul 26, 2023. It is now read-only.

Add User32 ChangeWindowMessageFilterEx and more #543

Merged
merged 1 commit into from
Nov 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/User32/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
PInvoke.User32.CHANGEFILTERSTRUCT
PInvoke.User32.CHANGEFILTERSTRUCT.CHANGEFILTERSTRUCT() -> void
PInvoke.User32.CHANGEFILTERSTRUCT.ExtStatus -> uint
PInvoke.User32.CHANGEFILTERSTRUCT.cbSize -> uint
PInvoke.User32.EnumDisplayDevicesFlags
PInvoke.User32.EnumDisplayDevicesFlags.EDD_GET_DEVICE_INTERFACE_NAME = 1 -> PInvoke.User32.EnumDisplayDevicesFlags
PInvoke.User32.EnumDisplaySettingsExFlags
Expand All @@ -9,6 +13,8 @@ PInvoke.User32.MONITORINFO_Flags.None = 0 -> PInvoke.User32.MONITORINFO_Flags
PInvoke.User32.WindowStylesEx.WS_EX_NOREDIRECTIONBITMAP = 2097152 -> PInvoke.User32.WindowStylesEx
const PInvoke.User32.ENUM_CURRENT_SETTINGS = 4294967295 -> uint
const PInvoke.User32.ENUM_REGISTRY_SETTINGS = 4294967294 -> uint
static PInvoke.User32.ChangeWindowMessageFilterEx(System.IntPtr hwnd, uint message, uint action, System.IntPtr pChangeFilterStruct) -> bool
static PInvoke.User32.ChangeWindowMessageFilterEx(System.IntPtr hwnd, uint message, uint action, ref PInvoke.User32.CHANGEFILTERSTRUCT? pChangeFilterStruct) -> bool
static PInvoke.User32.CreateCursor(System.IntPtr hInst, int xHotspot, int yHotSpot, int nWidth, int nHeight, System.ReadOnlySpan<byte> pvANDPlane, System.ReadOnlySpan<byte> pvXORPlane) -> PInvoke.User32.SafeCursorHandle
static PInvoke.User32.DrawText(PInvoke.User32.SafeDCHandle hdc, System.Span<char> lpchText, ref PInvoke.RECT lprc, PInvoke.User32.TextFormats format) -> int
static PInvoke.User32.DrawTextEx(PInvoke.User32.SafeDCHandle hdc, System.Span<char> lpchText, ref PInvoke.RECT lprc, uint dwDTFormat, PInvoke.User32.DRAWTEXTPARAMS? lpDTParams) -> int
Expand Down Expand Up @@ -39,9 +45,12 @@ static PInvoke.User32.MsgWaitForMultipleObjectsEx(uint nCount, System.ReadOnlySp
static PInvoke.User32.QueryDisplayConfig(uint Flags, ref int pNumPathArrayElements, System.Span<PInvoke.User32.DISPLAYCONFIG_PATH_INFO> pPathInfoArray, ref int pNumModeInfoArrayElements, System.Span<PInvoke.User32.DISPLAYCONFIG_MODE_INFO> pModeInfoArray, PInvoke.User32.DISPLAYCONFIG_TOPOLOGY_ID pCurrentTopologyId) -> int
static PInvoke.User32.RealGetWindowClass(System.IntPtr hwnd, System.Span<char> pszType) -> uint
static PInvoke.User32.SendInput(int nInputs, System.ReadOnlySpan<PInvoke.User32.INPUT> pInputs, int cbSize) -> uint
static extern PInvoke.User32.ChangeWindowMessageFilterEx(System.IntPtr hwnd, uint message, uint action, PInvoke.User32.CHANGEFILTERSTRUCT* pChangeFilterStruct) -> bool
static extern PInvoke.User32.EnumChildWindows(System.IntPtr hWndParent, System.IntPtr lpEnumFunc, System.IntPtr lParam) -> bool
static extern PInvoke.User32.EnumDisplayDevices(char* lpDevice, uint iDevNum, PInvoke.DISPLAY_DEVICE* lpDisplayDevice, PInvoke.User32.EnumDisplayDevicesFlags dwFlags) -> bool
static extern PInvoke.User32.EnumDisplaySettings(char* lpszDeviceName, uint iModeNum, PInvoke.DEVMODE* lpDevMode) -> bool
static extern PInvoke.User32.EnumDisplaySettingsEx(char* lpszDeviceName, uint iModeNum, PInvoke.DEVMODE* lpDevMode, PInvoke.User32.EnumDisplaySettingsExFlags dwFlags) -> bool
static extern PInvoke.User32.GetParent(System.IntPtr hWnd) -> System.IntPtr
static extern PInvoke.User32.LoadString(System.IntPtr hInstance, uint uID, char* lpBuffer, int cchBufferMax) -> int
static extern PInvoke.User32.UnregisterClass(string lpClassName, System.IntPtr hInstance) -> bool
static readonly PInvoke.User32.DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED -> System.IntPtr
Expand Down
35 changes: 35 additions & 0 deletions src/User32/User32+CHANGEFILTERSTRUCT.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright © .NET Foundation and Contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace PInvoke
{
/// <content>
/// Contains the <see cref="CHANGEFILTERSTRUCT"/> nested type.
/// </content>
public partial class User32
{
/// <summary>Contains extended result information obtained by calling the ChangeWindowMessageFilterEx function.</summary>
/// <remarks>
/// <para>Certain messages whose value is smaller than <b>WM_USER</b> are required to pass through the filter, regardless of the filter setting. There will be no effect when you attempt to use this function to allow or block such messages.</para>
/// <para>An application may use the <a href = "https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-changewindowmessagefilter">ChangeWindowMessageFilter</a> function to allow or block a message in a process-wide manner. If the message is allowed by either the process message filter or the window message filter, it will be delivered to the window.</para>
/// <para>The following table lists the possible values returned in <b>ExtStatus</b>.</para>
/// <para>This doc was truncated.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/ns-winuser-changefilterstruct#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public struct CHANGEFILTERSTRUCT
{
/// <summary>
/// <para>Type: <b>DWORD</b>The size of the structure, in bytes. Must be set to <c>sizeof(CHANGEFILTERSTRUCT)</c>, otherwise the function fails with <b>ERROR_INVALID_PARAMETER</b>.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/ns-winuser-changefilterstruct#members">Read more on docs.microsoft.com</see>.</para>
/// </summary>
public uint cbSize;

/// <summary>
/// <para>Type: <b>DWORD</b>If the function succeeds, this field contains one of the following values.</para>
/// <para>This doc was truncated.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/ns-winuser-changefilterstruct#members">Read more on docs.microsoft.com</see>.</para>
/// </summary>
public uint ExtStatus;
}
}
}
76 changes: 76 additions & 0 deletions src/User32/User32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3944,6 +3944,82 @@ public static unsafe extern uint MsgWaitForMultipleObjectsEx(
WakeMask dwWakeMask,
MsgWaitForMultipleObjectsExFlags dwFlags);

/// <summary>Modifies the User Interface Privilege Isolation (UIPI) message filter for a specified window.</summary>
/// <param name = "hwnd">
/// <para>Type: <b>HWND</b></para>
/// <para>A handle to the window whose UIPI message filter is to be modified.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-changewindowmessagefilterex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name = "message">
/// <para>Type: <b>UINT</b></para>
/// <para>The message that the message filter allows through or blocks.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-changewindowmessagefilterex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name = "action">
/// <para>Type: <b>DWORD</b>The action to be performed, and can take one of the following values:</para>
/// <para>This doc was truncated.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-changewindowmessagefilterex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name = "pChangeFilterStruct">
/// <para>Type: <b>PCHANGEFILTERSTRUCT</b></para>
/// <para>Optional pointer to a <a href = "https://docs.microsoft.com/windows/desktop/api/winuser/ns-winuser-changefilterstruct">CHANGEFILTERSTRUCT</a> structure.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-changewindowmessagefilterex#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>BOOL</b></para>
/// <para>If the function succeeds, it returns <b>TRUE</b>; otherwise, it returns <b>FALSE</b>. To get extended error information, call <a href = "https://docs.microsoft.com/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a>.</para>
/// </returns>
/// <remarks>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-changewindowmessagefilterex">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("User32", ExactSpelling = true, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern unsafe bool ChangeWindowMessageFilterEx(IntPtr hwnd, uint message, uint action, [Friendly(FriendlyFlags.Bidirectional | FriendlyFlags.Optional)] CHANGEFILTERSTRUCT* pChangeFilterStruct);

/// <summary>Retrieves a handle to the specified window's parent or owner.</summary>
/// <param name = "hWnd">
/// <para>Type: <b>HWND</b></para>
/// <para>A handle to the window whose parent window handle is to be retrieved.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-getparent#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>HWND</b>If the window is a child window, the return value is a handle to the parent window. If the window is a top-level window with the <b>WS_POPUP</b> style, the return value is a handle to the owner window.If the function fails, the return value is <b>NULL</b>. To get extended error information, call <a href = "https://docs.microsoft.com/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror">GetLastError</a>.This function typically fails for one of the following reasons:</para>
/// <para></para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-getparent">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("User32", ExactSpelling = true, SetLastError = true)]
public static extern IntPtr GetParent(IntPtr hWnd);

/// <summary>Enumerates the child windows that belong to the specified parent window by passing the handle to each child window, in turn, to an application-defined callback function.</summary>
/// <param name = "hWndParent">
/// <para>Type: <b>HWND</b></para>
/// <para>A handle to the parent window whose child windows are to be enumerated. If this parameter is <b>NULL</b>, this function is equivalent to <a href = "https://docs.microsoft.com/windows/desktop/api/winuser/nf-winuser-enumwindows">EnumWindows</a>.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-enumchildwindows#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name = "lpEnumFunc">
/// <para>Type: <b>WNDENUMPROC</b></para>
/// <para>A pointer to an application-defined callback function. For more information, see <a href = "https://docs.microsoft.com/previous-versions/windows/desktop/legacy/ms633493(v=vs.85)">EnumChildProc</a>.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-enumchildwindows#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name = "lParam">
/// <para>Type: <b>LPARAM</b></para>
/// <para>An application-defined value to be passed to the callback function.</para>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-enumchildwindows#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>Type: <b>BOOL</b></para>
/// <para>The return value is not used.</para>
/// </returns>
/// <remarks>
/// <para><see href = "https://docs.microsoft.com/en-us/windows/win32/api//winuser/nf-winuser-enumchildwindows">Learn more about this API from docs.microsoft.com</see>.</para>
/// </remarks>
[DllImport("User32", ExactSpelling = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EnumChildWindows(IntPtr hWndParent, IntPtr lpEnumFunc, IntPtr lParam);

/// <summary>
/// Retrieves the time of the last input event.
/// </summary>
Expand Down