Skip to content
This repository was archived by the owner on Jul 26, 2023. It is now read-only.
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
51 changes: 50 additions & 1 deletion src/User32/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
PInvoke.User32.DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS
PInvoke.User32.DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS.DCDC_DEFAULT = 0 -> PInvoke.User32.DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS
PInvoke.User32.DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS.DCDC_DISABLE_FONT_UPDATE = 1 -> PInvoke.User32.DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS
PInvoke.User32.DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS.DCDC_DISABLE_RELAYOUT = 2 -> PInvoke.User32.DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS
PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS
PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS.DDC_DEFAULT = 0 -> PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS
PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS.DDC_DISABLE_ALL = 1 -> PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS
PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS.DDC_DISABLE_CONTROL_RELAYOUT = PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS.DDC_DISABLE_ALL | PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS.DDC_DISABLE_RESIZE -> PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS
PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS.DDC_DISABLE_RESIZE = 2 -> PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS
PInvoke.User32.DPI_AWARENESS
PInvoke.User32.DPI_AWARENESS.DPI_AWARENESS_INVALID = -1 -> PInvoke.User32.DPI_AWARENESS
PInvoke.User32.DPI_AWARENESS.DPI_AWARENESS_PER_MONITOR_AWARE = 2 -> PInvoke.User32.DPI_AWARENESS
PInvoke.User32.DPI_AWARENESS.DPI_AWARENESS_SYSTEM_AWARE = 1 -> PInvoke.User32.DPI_AWARENESS
PInvoke.User32.DPI_AWARENESS.DPI_AWARENESS_UNAWARE = 0 -> PInvoke.User32.DPI_AWARENESS
PInvoke.User32.DPI_HOSTING_BEHAVIOR
PInvoke.User32.DPI_HOSTING_BEHAVIOR.DPI_HOSTING_BEHAVIOR_DEFAULT = 0 -> PInvoke.User32.DPI_HOSTING_BEHAVIOR
PInvoke.User32.DPI_HOSTING_BEHAVIOR.DPI_HOSTING_BEHAVIOR_INVALID = -1 -> PInvoke.User32.DPI_HOSTING_BEHAVIOR
PInvoke.User32.DPI_HOSTING_BEHAVIOR.DPI_HOSTING_BEHAVIOR_MIXED = 1 -> PInvoke.User32.DPI_HOSTING_BEHAVIOR
PInvoke.User32.GetNextWindowCommands
PInvoke.User32.GetNextWindowCommands.GW_HWNDNEXT = 2 -> PInvoke.User32.GetNextWindowCommands
PInvoke.User32.GetNextWindowCommands.GW_HWNDPREV = 3 -> PInvoke.User32.GetNextWindowCommands
Expand All @@ -15,6 +33,9 @@ PInvoke.User32.SendMessageTimeoutFlags.SMTO_BLOCK = 1 -> PInvoke.User32.SendMess
PInvoke.User32.SendMessageTimeoutFlags.SMTO_ERRORONEXIT = 32 -> PInvoke.User32.SendMessageTimeoutFlags
PInvoke.User32.SendMessageTimeoutFlags.SMTO_NORMAL = 0 -> PInvoke.User32.SendMessageTimeoutFlags
PInvoke.User32.SendMessageTimeoutFlags.SMTO_NOTIMEOUTIFNOTHUNG = 8 -> PInvoke.User32.SendMessageTimeoutFlags
PInvoke.User32.WindowMessage.WM_DPICHANGED_AFTERPARENT = 739 -> PInvoke.User32.WindowMessage
PInvoke.User32.WindowMessage.WM_DPICHANGED_BEFOREPARENT = 738 -> PInvoke.User32.WindowMessage
PInvoke.User32.WindowMessage.WM_GETDPISCALEDSIZE = 740 -> PInvoke.User32.WindowMessage
PInvoke.User32.mouse_eventFlags
PInvoke.User32.mouse_eventFlags.MOUSEEVENTF_ABSOLUTE = 32768 -> PInvoke.User32.mouse_eventFlags
PInvoke.User32.mouse_eventFlags.MOUSEEVENTF_HWHEEL = 4096 -> PInvoke.User32.mouse_eventFlags
Expand All @@ -28,14 +49,42 @@ PInvoke.User32.mouse_eventFlags.MOUSEEVENTF_RIGHTUP = 16 -> PInvoke.User32.mouse
PInvoke.User32.mouse_eventFlags.MOUSEEVENTF_WHEEL = 2048 -> PInvoke.User32.mouse_eventFlags
PInvoke.User32.mouse_eventFlags.MOUSEEVENTF_XDOWN = 128 -> PInvoke.User32.mouse_eventFlags
PInvoke.User32.mouse_eventFlags.MOUSEEVENTF_XUP = 256 -> PInvoke.User32.mouse_eventFlags
static PInvoke.User32.AdjustWindowRectExForDpi(System.IntPtr lpRect, PInvoke.User32.WindowStyles dwStyle, bool bMenu, PInvoke.User32.WindowStylesEx dwExStyle, int dpi) -> bool
static PInvoke.User32.CreateWindowEx(PInvoke.User32.WindowStylesEx dwExStyle, short lpClassName, string lpWindowName, PInvoke.User32.WindowStyles dwStyle, int x, int y, int nWidth, int nHeight, System.IntPtr hWndParent, System.IntPtr hMenu, System.IntPtr hInstance, System.IntPtr lpParam) -> System.IntPtr
static PInvoke.User32.CreateWindowEx(PInvoke.User32.WindowStylesEx dwExStyle, short lpClassName, string lpWindowName, PInvoke.User32.WindowStyles dwStyle, int x, int y, int nWidth, int nHeight, System.IntPtr hWndParent, System.IntPtr hMenu, System.IntPtr hInstance, void* lpParam) -> System.IntPtr
static PInvoke.User32.GetNextWindow(System.IntPtr hWnd, PInvoke.User32.GetNextWindowCommands wCmd) -> System.IntPtr
static PInvoke.User32.SystemParametersInfoForDpi(PInvoke.User32.SystemParametersInfoAction uiAction, int uiParam, System.IntPtr pvParam, PInvoke.User32.SystemParametersInfoFlags fWinIni, int dpi) -> bool
static PInvoke.User32.mouse_event(PInvoke.User32.mouse_eventFlags dwFlags, int dx, int dy, int dwData, System.IntPtr dwExtraInfo) -> void
static extern PInvoke.User32.AdjustWindowRectExForDpi(PInvoke.RECT* lpRect, PInvoke.User32.WindowStyles dwStyle, bool bMenu, PInvoke.User32.WindowStylesEx dwExStyle, int dpi) -> bool
static extern PInvoke.User32.AreDpiAwarenessContextsEqual(System.IntPtr dpiContextA, System.IntPtr dpiContextB) -> bool
static extern PInvoke.User32.DestroyWindow(System.IntPtr hWnd) -> bool
static extern PInvoke.User32.EnableNonClientDpiScaling(System.IntPtr hwnd) -> bool
static extern PInvoke.User32.GetAwarenessFromDpiAwarenessContext(System.IntPtr dpiAwarenessContext) -> PInvoke.User32.DPI_AWARENESS
static extern PInvoke.User32.GetDialogControlDpiChangeBehavior(System.IntPtr hWnd) -> PInvoke.User32.DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS
static extern PInvoke.User32.GetDialogDpiChangeBehavior(System.IntPtr hDlg) -> PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS
static extern PInvoke.User32.GetDpiForSystem() -> int
static extern PInvoke.User32.GetDpiForWindow(System.IntPtr hwnd) -> int
static extern PInvoke.User32.GetDpiFromDpiAwarenessContext(System.IntPtr dpiAwarenessContext) -> int
static extern PInvoke.User32.GetSystemDpiForProcess(PInvoke.Kernel32.SafeObjectHandle hProcess) -> int
static extern PInvoke.User32.GetSystemMetricsForDpi(int nIndex, int dpi) -> bool
static extern PInvoke.User32.GetThreadDpiAwarenessContext() -> System.IntPtr
static extern PInvoke.User32.GetThreadDpiHostingBehavior() -> PInvoke.User32.DPI_HOSTING_BEHAVIOR
static extern PInvoke.User32.GetTopWindow(System.IntPtr hWnd) -> System.IntPtr
static extern PInvoke.User32.GetWindow(System.IntPtr hWnd, PInvoke.User32.GetWindowCommands wCmd) -> System.IntPtr
static extern PInvoke.User32.GetWindowDpiAwarenessContext(System.IntPtr hwnd) -> System.IntPtr
static extern PInvoke.User32.GetWindowDpiHostingBehavior(System.IntPtr hwnd) -> PInvoke.User32.DPI_HOSTING_BEHAVIOR
static extern PInvoke.User32.IsValidDpiAwarenessContext(System.IntPtr dpiAwarenessContext) -> bool
static extern PInvoke.User32.SendMessageTimeout(System.IntPtr hWnd, PInvoke.User32.WindowMessage msg, System.IntPtr wParam, System.IntPtr lParam, PInvoke.User32.SendMessageTimeoutFlags flags, int timeout, out System.IntPtr pdwResult) -> System.IntPtr
static extern PInvoke.User32.SetDialogControlDpiChangeBehavior(System.IntPtr hwnd, PInvoke.User32.DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS mask, PInvoke.User32.DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS values) -> bool
static extern PInvoke.User32.SetDialogDpiChangeBehavior(System.IntPtr hDlg, PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS mask, PInvoke.User32.DIALOG_DPI_CHANGE_BEHAVIORS values) -> bool
static extern PInvoke.User32.SetLastErrorEx(uint dwErrCode, uint dwType) -> void
static extern PInvoke.User32.SetProcessDpiAwarenessContext(System.IntPtr dpiAWarenessContext) -> bool
static extern PInvoke.User32.SetThreadDpiAwarenessContext(System.IntPtr dpiContext) -> System.IntPtr
static extern PInvoke.User32.SetThreadDpiHostingBehavior(PInvoke.User32.DPI_HOSTING_BEHAVIOR dpiHostingBehavior) -> PInvoke.User32.DPI_HOSTING_BEHAVIOR
static extern PInvoke.User32.SetWindowText(System.IntPtr hWnd, string lpString) -> bool
static extern PInvoke.User32.mouse_event(PInvoke.User32.mouse_eventFlags dwFlags, int dx, int dy, int dwData, void* dwExtraInfo) -> void
static extern PInvoke.User32.SystemParametersInfoForDpi(PInvoke.User32.SystemParametersInfoAction uiAction, int uiParam, void* pvParam, PInvoke.User32.SystemParametersInfoFlags fWinIni, int dpi) -> bool
static extern PInvoke.User32.mouse_event(PInvoke.User32.mouse_eventFlags dwFlags, int dx, int dy, int dwData, void* dwExtraInfo) -> void
static readonly PInvoke.User32.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE -> System.IntPtr
static readonly PInvoke.User32.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 -> System.IntPtr
static readonly PInvoke.User32.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE -> System.IntPtr
static readonly PInvoke.User32.DPI_AWARENESS_CONTEXT_UNAWARE -> System.IntPtr
40 changes: 40 additions & 0 deletions src/User32/User32+DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace PInvoke
{
using System;

/// <content>
/// Contains nested type <see cref="DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS"/>
/// </content>
public partial class User32
{
/// <summary>
/// Describes per-monitor DPI scaling behavior overrides for child windows within dialogs. The values in this enumeration are bitfields and can be combined.
/// </summary>
/// <remarks>
/// This enum is used with SetDialogControlDpiChangeBehavior in order to override the default per-monitor DPI scaling behavior for a child window within a dialog.
///
/// These settings only apply to individual controls within dialogs. The dialog-wide per-monitor DPI scaling behavior of a dialog is controlled by <see cref="DIALOG_DPI_CHANGE_BEHAVIORS"/>.
/// </remarks>
[Flags]
public enum DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS : int
{
/// <summary>
/// The default behavior of the dialog manager. The dialog managed will update the font, size, and position of the child window on DPI changes.
/// </summary>
DCDC_DEFAULT = 0x0000,

/// <summary>
/// Prevents the dialog manager from sending an updated font to the child window via WM_SETFONT in response to a DPI change.
/// </summary>
DCDC_DISABLE_FONT_UPDATE = 0x0001,

/// <summary>
/// Prevents the dialog manager from resizing and repositioning the child window in response to a DPI change.
/// </summary>
DCDC_DISABLE_RELAYOUT = 0x0002,
}
}
}
42 changes: 42 additions & 0 deletions src/User32/User32+DIALOG_DPI_CHANGE_BEHAVIORS.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace PInvoke
{
using System;

/// <content>
/// Contains nested type <see cref="DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS"/>
/// </content>
public partial class User32
{
/// <summary>
/// In Per Monitor v2 contexts, dialogs will automatically respond to DPI changes by resizing themselves and re-computing the positions of their child windows (here referred to as re-layouting).
/// This enum works in conjunction with SetDialogDpiChangeBehavior in order to override the default DPI scaling behavior for dialogs.
/// This does not affect DPI scaling behavior for the child windows of dialogs(beyond re-layouting), which is controlled by <see cref="DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS"/>.
/// </summary>
[Flags]
public enum DIALOG_DPI_CHANGE_BEHAVIORS : int
{
/// <summary>
/// The default behavior of the dialog manager. In response to a DPI change, the dialog manager will re-layout each control, update the font on each control, resize the dialog, and update the dialog's own font.
/// </summary>
DDC_DEFAULT = 0x0000,

/// <summary>
/// Prevents the dialog manager from responding to <see cref="WindowMessage.WM_GETDPISCALEDSIZE"/> and <see cref="WindowMessage.WM_DPICHANGED"/>, disabling all default DPI scaling behavior.
/// </summary>
DDC_DISABLE_ALL = 0x0001,

/// <summary>
/// Prevents the dialog manager from resizing the dialog in response to a DPI change.
/// </summary>
DDC_DISABLE_RESIZE = 0x0002,

/// <summary>
/// Prevents the dialog manager from re-layouting all of the dialogue's immediate children HWNDs in response to a DPI change.
/// </summary>
DDC_DISABLE_CONTROL_RELAYOUT = 0x0003,
}
}
}
37 changes: 37 additions & 0 deletions src/User32/User32+DPI_AWARENESS.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) All 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="DPI_AWARENESS"/> nested type.
/// </content>
public partial class User32
{
/// <summary>
/// Identifies the dots per inch (dpi) setting for a thread, process, or window.
/// </summary>
public enum DPI_AWARENESS : int
{
/// <summary>
/// Invalid DPI awareness. This is an invalid DPI awareness value.
/// </summary>
DPI_AWARENESS_INVALID = -1,

/// <summary>
/// DPI unaware. This process does not scale for DPI changes and is always assumed to have a scale factor of 100% (96 DPI). It will be automatically scaled by the system on any other DPI setting.
/// </summary>
DPI_AWARENESS_UNAWARE = 0,

/// <summary>
/// System DPI aware. This process does not scale for DPI changes. It will query for the DPI once and use that value for the lifetime of the process. If the DPI changes, the process will not adjust to the new DPI value. It will be automatically scaled up or down by the system when the DPI changes from the system value.
/// </summary>
DPI_AWARENESS_SYSTEM_AWARE = 1,

/// <summary>
/// Per monitor DPI aware. This process checks for the DPI when it is created and adjusts the scale factor whenever the DPI changes. These processes are not automatically scaled by the system.
/// </summary>
DPI_AWARENESS_PER_MONITOR_AWARE = 2,
}
}
}
32 changes: 32 additions & 0 deletions src/User32/User32+DPI_HOSTING_BEHAVIOR.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace PInvoke
{
/// <content>
/// Contains nested type <see cref="DPI_HOSTING_BEHAVIOR"/>
/// </content>
public partial class User32
{
/// <summary>
/// Identifies the DPI hosting behavior for a window. This behavior allows windows created in the thread to host child windows with a different DPI_AWARENESS_CONTEXT.
/// </summary>
public enum DPI_HOSTING_BEHAVIOR : int
{
/// <summary>
/// Invalid DPI hosting behavior. This usually occurs if the previous <see cref="SetThreadDpiHostingBehavior"/> call used an invalid parameter.
/// </summary>
DPI_HOSTING_BEHAVIOR_INVALID = -1,

/// <summary>
/// Default DPI hosting behavior. The associated window behaves as normal, and cannot create or re-parent child windows with a different DPI_AWARENESS_CONTEXT.
/// </summary>
DPI_HOSTING_BEHAVIOR_DEFAULT = 0,

/// <summary>
/// Mixed DPI hosting behavior. This enables the creation and re-parenting of child windows with different DPI_AWARENESS_CONTEXT. These child windows will be independently scaled by the OS.
/// </summary>
DPI_HOSTING_BEHAVIOR_MIXED = 1,
}
}
}
15 changes: 15 additions & 0 deletions src/User32/User32+WindowMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,21 @@ public enum WindowMessage : int
/// </summary>
WM_DPICHANGED = 0x02E0,

/// <summary>
/// For Per Monitor v2 top-level windows, this message is sent to all HWNDs in the child HWDN tree of the window that is undergoing a DPI change. This message occurs before the top-level window receives <see cref="WM_DPICHANGED"/>, and traverses the child tree from the bottom up.
/// </summary>
WM_DPICHANGED_BEFOREPARENT = 0x02E2,

/// <summary>
/// For Per Monitor v2 top-level windows, this message is sent to all HWNDs in the child HWDN tree of the window that is undergoing a DPI change. This message occurs after the top-level window receives <see cref="WM_DPICHANGED"/>, and traverses the child tree from the top down.
/// </summary>
WM_DPICHANGED_AFTERPARENT = 0x02E3,

/// <summary>
/// The WM_GETDPISCALEDSIZE message tells the operating system that the window will be sized to dimensions other than the default.
/// </summary>
WM_GETDPISCALEDSIZE = 0x02E4,

/// <summary>
/// An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format.
/// </summary>
Expand Down
Loading