From 09d4e2f1a1bc206c80d8d3287d070c70ec7fd63d Mon Sep 17 00:00:00 2001
From: chunhualin1 <chunhualin1@lenovo.com>
Date: 星期五, 14 八月 2026 20:00:52 +0800
Subject: [PATCH] Merge branch 'master' of http://git.linmoli.cn/r/Moli.Desktop
---
src/Moli.Desktop/Interop/NativeMethods.cs | 36 +++++++++++++++++++++++++++++++-----
1 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/src/Moli.Desktop/Interop/NativeMethods.cs b/src/Moli.Desktop/Interop/NativeMethods.cs
index 2922088..9bc2ea8 100644
--- a/src/Moli.Desktop/Interop/NativeMethods.cs
+++ b/src/Moli.Desktop/Interop/NativeMethods.cs
@@ -6,19 +6,30 @@
internal static class NativeMethods
{
+ internal const int GwlStyle = -16;
internal const int GwlExStyle = -20;
+ internal const uint WsChild = 0x40000000;
+ internal const uint WsPopup = 0x80000000;
+ internal const uint WsVisible = 0x10000000;
internal const int WsExTransparent = 0x00000020;
internal const int WsExLayered = 0x00080000;
internal const int WsExToolWindow = 0x00000080;
internal const int WsExNoActivate = 0x08000000;
- internal const int LwaAlpha = 0x00000002;
internal const uint SwpNoSize = 0x0001;
internal const uint SwpNoMove = 0x0002;
internal const uint SwpNoZOrder = 0x0004;
internal const uint SwpNoActivate = 0x0010;
+ internal const uint SwpFrameChanged = 0x0020;
internal const uint SwpShowWindow = 0x0040;
internal const uint SmtoNormal = 0x0000;
+ internal const int WmDisplayChange = 0x007E;
+ internal const int WmSettingChange = 0x001A;
+ internal const int WmDeviceChange = 0x0219;
+ internal const int WmHotkey = 0x0312;
+ internal const int MdtEffectiveDpi = 0;
+ internal const int ErrorHotkeyAlreadyRegistered = 1409;
internal static readonly IntPtr HwndBottom = new(1);
+ internal static readonly IntPtr HwndMessage = new(-3);
internal delegate bool EnumWindowsProc(IntPtr hwnd, IntPtr lParam);
internal delegate bool MonitorEnumProc(IntPtr hMonitor, IntPtr hdcMonitor, ref Rect lprcMonitor, IntPtr dwData);
@@ -34,10 +45,6 @@
[DllImport("user32.dll", EntryPoint = "SetWindowLongW", SetLastError = true)]
internal static extern int SetWindowLong32(IntPtr hWnd, int nIndex, int dwNewLong);
-
- [DllImport("user32.dll", SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
@@ -67,6 +74,25 @@
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool GetMonitorInfo(IntPtr hMonitor, ref MonitorInfoEx lpmi);
+ [DllImport("shcore.dll", SetLastError = false)]
+ internal static extern int GetDpiForMonitor(IntPtr hMonitor, int dpiType, out uint dpiX, out uint dpiY);
+
+ [DllImport("user32.dll", SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool GetWindowRect(IntPtr hWnd, out Rect lpRect);
+
+ [DllImport("user32.dll", SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);
+
+ [DllImport("user32.dll", SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool UnregisterHotKey(IntPtr hWnd, int id);
+
+ [DllImport("user32.dll", SetLastError = false)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool IsWindow(IntPtr hWnd);
+
internal static IntPtr GetWindowLongPtr(IntPtr hwnd, int index)
{
return IntPtr.Size == 8
--
Gitblit v1.9.1