From 3a35704a45df3125fc968bccbee5be27adbddbc2 Mon Sep 17 00:00:00 2001 From: Daniel Chalmers Date: Wed, 4 Nov 2026 13:25:03 -0600 Subject: [PATCH 1/2] Stop bringing in settings from other copies A copy at a new path, like a renamed portable download, now starts on default settings, as it did before 4.1. Bringing in the newest other copy's settings meant editing .NET's config XML, choosing between copies, and scanning for running ones, all to save picking a few menu options again. Saving a second after each change, and replacing a settings file that can't be read, both stay. --- .../UserConfigImportTests.cs | 144 ------------------ Network Monitor/SettingsStartup.cs | 82 +--------- Network Monitor/UserConfigImport.cs | 122 --------------- 3 files changed, 4 insertions(+), 344 deletions(-) delete mode 100644 Network Monitor.Tests/UserConfigImportTests.cs delete mode 100644 Network Monitor/UserConfigImport.cs diff --git a/Network Monitor.Tests/UserConfigImportTests.cs b/Network Monitor.Tests/UserConfigImportTests.cs deleted file mode 100644 index fecce04..0000000 --- a/Network Monitor.Tests/UserConfigImportTests.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Xml.Linq; - -namespace Network_Monitor.Tests; - -public sealed class UserConfigImportTests : IDisposable -{ - private readonly string _root = Path.Combine(Path.GetTempPath(), "NetworkMonitorTests", Guid.NewGuid().ToString("N")); - - public void Dispose() - { - if (Directory.Exists(_root)) - Directory.Delete(_root, recursive: true); - } - - private string CurrentCopyPath => Path.Combine(_root, "Network.Monitor_(1).exe_Url_new", "4.1.0.0", "user.config"); - - private string WriteConfig(string copyFolder, string version, DateTime writtenUtc, bool declared = true, bool withPlacement = true, string size = "96") - { - var path = Path.Combine(_root, copyFolder, version, "user.config"); - Directory.CreateDirectory(Path.GetDirectoryName(path)); - - var declaration = declared - ? """ - - -
- - - """ - : ""; - var placement = withPlacement - ? """44""" - : ""; - - File.WriteAllText(path, $""" - - - {declaration} - - - False - {size} - {placement} - - - - """); - File.SetLastWriteTimeUtc(path, writtenUtc); - return path; - } - - private static string ReadSetting(string path, string name) => - XDocument.Load(path).Descendants("setting").FirstOrDefault(x => (string)x.Attribute("name") == name)?.Element("value")?.Value; - - [Fact] - public void ImportIfNewCopy_CopiesTheMostRecentlySavedSettings() - { - WriteConfig("Network.Monitor.exe_Url_old", "4.0.0.0", new DateTime(2026, 1, 1), size: "150"); - var newest = WriteConfig("Network_Monitor.exe_Url_msi", "4.0.0.0", new DateTime(2026, 9, 1), size: "200"); - - var imported = UserConfigImport.ImportIfNewCopy(CurrentCopyPath, includePlacement: true); - - Assert.Equal(newest, imported); - Assert.Equal("200", ReadSetting(CurrentCopyPath, "Size")); - } - - [Fact] - public void ImportIfNewCopy_WhenThisCopyHasSavedBefore_LeavesItToUpgrade() - { - WriteConfig("Network.Monitor_(1).exe_Url_new", "4.0.0.0", new DateTime(2026, 1, 1), size: "150"); - WriteConfig("Network_Monitor.exe_Url_msi", "4.0.0.0", new DateTime(2026, 9, 1), size: "200"); - - var imported = UserConfigImport.ImportIfNewCopy(CurrentCopyPath, includePlacement: true); - - Assert.Null(imported); - Assert.False(File.Exists(CurrentCopyPath)); - } - - [Fact] - public void ImportIfNewCopy_SkipsFilesThatCantBeRead() - { - var readable = WriteConfig("Network.Monitor.exe_Url_old", "4.0.0.0", new DateTime(2026, 1, 1), size: "150"); - var truncated = Path.Combine(_root, "Network_Monitor.exe_Url_msi", "4.0.0.0", "user.config"); - Directory.CreateDirectory(Path.GetDirectoryName(truncated)); - File.WriteAllText(truncated, " - /// Brings in another copy's settings if this copy has none, upgrades settings from an older version, and repairs a settings file that can't be read. + /// Upgrades settings from an older version, and repairs a settings file that can't be read. /// /// False when the app restarted itself to load repaired settings, so this process should exit. public static bool Prepare(string[] args) { - var userConfigPath = TryGetUserConfigPath(); - try { - if (userConfigPath != null) - TryImport(userConfigPath); - if (Settings.Default.MustUpgrade) { Settings.Default.Upgrade(); @@ -36,7 +31,7 @@ public static bool Prepare(string[] args) return true; } - catch (ConfigurationErrorsException ex) when (!args.Contains(RepairedArgument) && TryDeleteUnreadable(ex, userConfigPath)) + catch (ConfigurationErrorsException ex) when (!args.Contains(RepairedArgument) && TryDeleteUnreadable(ex)) { // The settings already failed to load in this process and can't be loaded again, so start over in a fresh one. SingleInstance.Release(); @@ -46,49 +41,16 @@ public static bool Prepare(string[] args) } /// - /// Returns where this copy keeps its settings for the current version, or null if the existing file can't even be opened, which deals with. - /// - private static string TryGetUserConfigPath() - { - try - { - return ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; - } - catch (ConfigurationErrorsException) - { - return null; - } - } - - private static void TryImport(string userConfigPath) - { - try - { - UserConfigImport.ImportIfNewCopy(userConfigPath, includePlacement: !IsAnotherCopyRunning()); - } - catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or System.Xml.XmlException) - { - // Starting from defaults is better than not starting. - } - } - - /// - /// Deletes the settings file that failed to load, as long as it belongs to this copy (the current file or the older one reads). + /// Deletes the settings file that failed to load, which is this copy's current one or the older one reads. /// A file cut short by a power loss would otherwise stop the app from starting every time, and reinstalling doesn't remove it. /// - private static bool TryDeleteUnreadable(ConfigurationErrorsException exception, string userConfigPath) + private static bool TryDeleteUnreadable(ConfigurationErrorsException exception) { var failedFile = (exception.InnerException as ConfigurationErrorsException)?.Filename ?? exception.Filename; if (string.IsNullOrEmpty(failedFile) || !string.Equals(Path.GetFileName(failedFile), "user.config", StringComparison.OrdinalIgnoreCase)) return false; - // When the current file can't be opened its path isn't known up front, but the failing file names it. - var copyFolder = Path.GetDirectoryName(Path.GetDirectoryName(userConfigPath ?? failedFile)); - - if (!IsInFolder(failedFile, copyFolder)) - return false; - try { File.Delete(failedFile); @@ -99,40 +61,4 @@ private static bool TryDeleteUnreadable(ConfigurationErrorsException exception, return false; } } - - /// - /// Returns whether is inside . - /// - public static bool IsInFolder(string path, string folder) => - Path.GetFullPath(path).StartsWith(Path.GetFullPath(folder).TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase); - - /// - /// Returns whether another copy of Network Monitor is running, at any path. - /// - private static bool IsAnotherCopyRunning() - { - var currentId = Process.GetCurrentProcess().Id; - - foreach (var process in Process.GetProcesses()) - { - try - { - // Downloads can be renamed (like "Network.Monitor (1)"), so look at what the exe says it is rather than its name. - if (process.Id != currentId && - process.ProcessName.IndexOf("Network", StringComparison.OrdinalIgnoreCase) >= 0 && - process.MainModule?.FileVersionInfo.ProductName == "Network Monitor") - return true; - } - catch - { - // Processes we can't inspect, like elevated ones, aren't ours. - } - finally - { - process.Dispose(); - } - } - - return false; - } } diff --git a/Network Monitor/UserConfigImport.cs b/Network Monitor/UserConfigImport.cs deleted file mode 100644 index 9302b1c..0000000 --- a/Network Monitor/UserConfigImport.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml.Linq; - -namespace Network_Monitor; - -/// -/// Brings in another copy's settings the first time a copy of the app runs. -/// Windows keeps settings per exe path, so a portable download saved under a new name or in a new folder, or switching between the installer and the portable exe, would otherwise start from scratch. -/// -public static class UserConfigImport -{ - private const string FileName = "user.config"; - private const string SectionName = "Network_Monitor.Properties.Settings"; - - /// - /// Copies the most recently saved settings of another copy into when this copy has never saved settings in any version. - /// The other copies' files are only read. - /// - /// Where this copy keeps its settings for the current version. - /// Whether to bring the window position along; leaving it out keeps a new copy from opening exactly on top of one that's still running. - /// The file that was imported, or null if nothing was. - public static string ImportIfNewCopy(string userConfigPath, bool includePlacement) - { - var versionFolder = Path.GetDirectoryName(userConfigPath); - var copyFolder = Path.GetDirectoryName(versionFolder); - var settingsRoot = Path.GetDirectoryName(copyFolder); - - // A settings file for any version means this copy has run before, and in-place updates keep going through Upgrade(). - if (Directory.Exists(copyFolder) && Directory.EnumerateFiles(copyFolder, FileName, SearchOption.AllDirectories).Any()) - return null; - - var source = FindNewestReadable(settingsRoot, copyFolder); - - if (source is null) - return null; - - var document = XDocument.Load(source); - EnsureSectionDeclared(document); - - if (!includePlacement) - GetSettings(document).Where(x => (string)x.Attribute("name") == "Placement").Remove(); - - // Written next to the destination and then moved into place, so a crash halfway through can't leave a half-written settings file. - Directory.CreateDirectory(versionFolder); - var tempPath = userConfigPath + ".import"; - document.Save(tempPath); - File.Move(tempPath, userConfigPath); - - return source; - } - - /// - /// Returns the most recently written settings file under that can be read, skipping anything in . - /// - public static string FindNewestReadable(string settingsRoot, string excludedFolder) - { - if (!Directory.Exists(settingsRoot)) - return null; - - var excludedPrefix = excludedFolder.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar; - - return new DirectoryInfo(settingsRoot) - .EnumerateFiles(FileName, SearchOption.AllDirectories) - .Where(x => !x.FullName.StartsWith(excludedPrefix, StringComparison.OrdinalIgnoreCase)) - .Where(x => x.Length > 0 && IsReadable(x.FullName)) - .OrderByDescending(x => x.LastWriteTimeUtc) - .FirstOrDefault()?.FullName; - } - - private static bool IsReadable(string path) - { - try - { - return GetSettings(XDocument.Load(path)).Any(); - } - catch - { - // A file cut short by a power loss isn't worth bringing along. - return false; - } - } - - private static IEnumerable GetSettings(XDocument document) => - document.Root?.Element("userSettings")?.Element(SectionName)?.Elements("setting") ?? Enumerable.Empty(); - - /// - /// Adds the declaration of the settings section if the file doesn't have one. - /// Files written by a build that came with its .exe.config, such as a debug build, leave it out, and the published exe can't load them without it. - /// - private static void EnsureSectionDeclared(XDocument document) - { - var configSections = document.Root.Element("configSections"); - - if (configSections is null) - { - configSections = new XElement("configSections"); - document.Root.AddFirst(configSections); - } - - var group = configSections.Elements("sectionGroup").FirstOrDefault(x => (string)x.Attribute("name") == "userSettings"); - - if (group is null) - { - group = new XElement("sectionGroup", - new XAttribute("name", "userSettings"), - new XAttribute("type", "System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")); - configSections.Add(group); - } - - if (group.Elements("section").Any(x => (string)x.Attribute("name") == SectionName)) - return; - - group.Add(new XElement("section", - new XAttribute("name", SectionName), - new XAttribute("type", "System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), - new XAttribute("allowExeDefinition", "MachineToLocalUser"), - new XAttribute("requirePermission", "false"))); - } -} From d97539b3b6b4dd46afd82b07d80c9873fa126d91 Mon Sep 17 00:00:00 2001 From: Daniel Chalmers Date: Wed, 4 Nov 2026 13:42:20 -0600 Subject: [PATCH 2/2] Add per-monitor DPI awareness - Add app.manifest declaring PerMonitorV2 DPI awareness - Set DoNotScaleForDpiChanges=false in OnStartup, since we ship just the exe - Do edge and on-screen placement in device pixels; move with one SetWindowPos call --- .../SizeAndPlacementTests.cs | 9 +++ Network Monitor/App.xaml.cs | 4 ++ Network Monitor/MainWindow.xaml.cs | 29 +++++---- Network Monitor/Network Monitor.csproj | 1 + Network Monitor/ScreenEdges.cs | 59 +++++++++++-------- Network Monitor/app.manifest | 27 +++++++++ README.md | 1 + 7 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 Network Monitor/app.manifest diff --git a/Network Monitor.Tests/SizeAndPlacementTests.cs b/Network Monitor.Tests/SizeAndPlacementTests.cs index 6a55437..e41d096 100644 --- a/Network Monitor.Tests/SizeAndPlacementTests.cs +++ b/Network Monitor.Tests/SizeAndPlacementTests.cs @@ -119,6 +119,15 @@ public void KeepOnScreen_PullsAWindowBackOntoTheScreen() Assert.Equal(new Point(2432, 0), ScreenEdges.KeepOnScreen(new Rect(2500, -20, 128, 138), Screen)); } + [Fact] + public void ToDevicePixels_AtAScaleThatDoesNotDivideEvenly_GivesWholePixels() + { + // At 175%, 115 pixels is about 65.71 units, which multiplies back to 114.99999999999999. + var size = ScreenEdges.ToDevicePixels(new Size(115 / 1.75, 122 / 1.75), new DpiScale(1.75, 1.75)); + + Assert.Equal(new Size(115, 122), size); + } + private static Point Resize(Rect oldBounds, Size newSize) => ScreenEdges.GetPositionAfterResize(oldBounds, newSize, Screen, ScreenEdges.GetFixedEdges(oldBounds, Screen)); } diff --git a/Network Monitor/App.xaml.cs b/Network Monitor/App.xaml.cs index a3ae77f..1fb8a8b 100644 --- a/Network Monitor/App.xaml.cs +++ b/Network Monitor/App.xaml.cs @@ -30,6 +30,10 @@ protected override void OnStartup(StartupEventArgs e) // Three numbers gain nothing from the graphics card, and drawing them in software saves about 10 MB of memory with no visible difference. RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; + // app.manifest has Windows leave each monitor's scale to the app, and this has WPF draw the widget again at the new scale when it changes, rather than keep the old one. + // It has to be set before the first window is created. + AppContext.SetSwitch("Switch.System.Windows.DoNotScaleForDpiChanges", false); + base.OnStartup(e); if (!SingleInstance.TryClaim(ExePath)) diff --git a/Network Monitor/MainWindow.xaml.cs b/Network Monitor/MainWindow.xaml.cs index 3c36721..0c8e5bf 100644 --- a/Network Monitor/MainWindow.xaml.cs +++ b/Network Monitor/MainWindow.xaml.cs @@ -7,6 +7,7 @@ using System.Windows.Controls; using System.Windows.Input; using System.Windows.Interop; +using System.Windows.Media; using Network_Monitor.Monitors; using Network_Monitor.Properties; using WpfWindowPlacement; @@ -52,10 +53,13 @@ private void MainWindow_OnMouseDown(object sender, MouseButtonEventArgs e) } private const int WM_MOUSEWHEEL = 0x020A; + private const int WM_ENTERSIZEMOVE = 0x0231; + private const int WM_EXITSIZEMOVE = 0x0232; private const int MK_CONTROL = 0x0008; private double _pendingWheelSteps; private bool _hasRendered; + private bool _isBeingMoved; private ScreenEdges.FixedEdges? _fixedEdges; private bool _isRepositioning; @@ -69,13 +73,19 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b var point = lParam.ToInt64(); // Windows can send the wheel to the active window wherever the pointer is, so only resize when it's over the widget. - if ((data & MK_CONTROL) != 0 && ScreenEdges.IsOverWindow(this, (short)(point & 0xFFFF), (short)((point >> 16) & 0xFFFF))) + if ((data & MK_CONTROL) != 0 && ScreenEdges.GetBounds(this).Contains((short)(point & 0xFFFF), (short)((point >> 16) & 0xFFFF))) { ResizeByWheel((short)((data >> 16) & 0xFFFF)); handled = true; } } + // While the window is dragged, or moved with the keyboard, Windows moves it along with the pointer, and nothing else should move it. + if (msg == WM_ENTERSIZEMOVE) + _isBeingMoved = true; + else if (msg == WM_EXITSIZEMOVE) + _isBeingMoved = false; + return IntPtr.Zero; } @@ -104,11 +114,8 @@ private void ResizeByWheel(int delta) /// public void Reveal() { - var bounds = new Rect(ScreenEdges.GetTopLeft(this), new Size(ActualWidth, ActualHeight)); - var position = ScreenEdges.KeepOnScreen(bounds, ScreenEdges.GetScreenBounds(this)); + ScreenEdges.MoveTo(this, ScreenEdges.KeepOnScreen(ScreenEdges.GetBounds(this), ScreenEdges.GetScreenBounds(this))); - Left = position.X; - Top = position.Y; Activate(); } @@ -120,19 +127,21 @@ private void Window_ContentRendered(object sender, EventArgs e) private void Window_SizeChanged(object sender, SizeChangedEventArgs e) { // Sizing while the window first appears isn't a resize, and moving it then would undo its restored position. - if (!_hasRendered || e.PreviousSize.Width <= 0 || e.PreviousSize.Height <= 0) + // Nor is the small change in size when it's dragged onto a monitor with a different scale, when it should stay under the pointer. + if (!_hasRendered || _isBeingMoved || e.PreviousSize.Width <= 0 || e.PreviousSize.Height <= 0) return; - var oldBounds = new Rect(ScreenEdges.GetTopLeft(this), e.PreviousSize); + // The sizes are in WPF units, so they're measured in device pixels like the screen, at the window's scale now. + var dpi = VisualTreeHelper.GetDpi(this); + var oldBounds = new Rect(ScreenEdges.GetBounds(this).TopLeft, ScreenEdges.ToDevicePixels(e.PreviousSize, dpi)); var screen = ScreenEdges.GetScreenBounds(this); _fixedEdges ??= ScreenEdges.GetFixedEdges(oldBounds, screen); - var position = ScreenEdges.GetPositionAfterResize(oldBounds, e.NewSize, screen, _fixedEdges.Value); + var position = ScreenEdges.GetPositionAfterResize(oldBounds, ScreenEdges.ToDevicePixels(e.NewSize, dpi), screen, _fixedEdges.Value); _isRepositioning = true; try { - Left = position.X; - Top = position.Y; + ScreenEdges.MoveTo(this, position); } finally { diff --git a/Network Monitor/Network Monitor.csproj b/Network Monitor/Network Monitor.csproj index cf2fd49..9d2848c 100644 --- a/Network Monitor/Network Monitor.csproj +++ b/Network Monitor/Network Monitor.csproj @@ -6,6 +6,7 @@ true latest Network Monitor.ico + app.manifest © Daniel Chalmers 0.0.0 false diff --git a/Network Monitor/ScreenEdges.cs b/Network Monitor/ScreenEdges.cs index d5c155d..8d729b3 100644 --- a/Network Monitor/ScreenEdges.cs +++ b/Network Monitor/ScreenEdges.cs @@ -2,7 +2,6 @@ using System.Runtime.InteropServices; using System.Windows; using System.Windows.Interop; -using System.Windows.Media; namespace Network_Monitor; @@ -10,6 +9,10 @@ namespace Network_Monitor; /// Keeps the widget against the screen edges it's parked near when its size changes, and on its monitor. /// Windows grow from their top-left corner, so a widget parked in a bottom or right corner would otherwise spill off the screen whenever it got bigger. /// +/// +/// Places on the screen are in device pixels, as Windows gives them, rather than in WPF's units. +/// Each monitor can have its own scale, and a window's and are in the units of whichever monitor it's on at the time, so they don't line up from one monitor to the next. +/// public static class ScreenEdges { /// @@ -64,28 +67,38 @@ public static Point KeepOnScreen(Rect bounds, Rect screen) } /// - /// Returns where the window actually is on screen, in the window's own units. + /// Returns how big , in WPF units, is in device pixels at the scale . + /// It's rounded to whole pixels, which is all a window can measure. + /// + public static Size ToDevicePixels(Size size, DpiScale dpi) => + new(Math.Round(size.Width * dpi.DpiScaleX), Math.Round(size.Height * dpi.DpiScaleY)); + + /// + /// Returns where the window actually is on screen, in device pixels. /// This is read from the window itself because and can lag behind a position restored straight onto the window. /// - public static Point GetTopLeft(Window window) + public static Rect GetBounds(Window window) { NativeMethods.GetWindowRect(new WindowInteropHelper(window).Handle, out var rect); - return GetFromDevice(window).Transform(new Point(rect.Left, rect.Top)); + return ToRect(rect); } /// - /// Returns whether a point on the screen, in device pixels, is over the window. + /// Moves the window's top-left corner to , in device pixels, without resizing or activating it. + /// It's moved in one step, because setting and then could take it across another monitor on the way and change its scale partway. /// - public static bool IsOverWindow(Window window, int x, int y) - { - if (!NativeMethods.GetWindowRect(new WindowInteropHelper(window).Handle, out var rect)) - return false; - - return x >= rect.Left && x < rect.Right && y >= rect.Top && y < rect.Bottom; - } + public static void MoveTo(Window window, Point position) => + NativeMethods.SetWindowPos( + new WindowInteropHelper(window).Handle, + IntPtr.Zero, + (int)Math.Round(position.X), + (int)Math.Round(position.Y), + 0, + 0, + NativeMethods.SWP_NOSIZE | NativeMethods.SWP_NOZORDER | NativeMethods.SWP_NOACTIVATE); /// - /// Returns the bounds of the monitor the window is on (or nearest to), in the window's own units. + /// Returns the bounds of the monitor the window is on (or nearest to), in device pixels. /// The whole monitor is used rather than the area above the taskbar, so a widget parked on the taskbar can stay there. /// public static Rect GetScreenBounds(Window window) @@ -94,22 +107,19 @@ public static Rect GetScreenBounds(Window window) var monitor = NativeMethods.MonitorFromWindow(handle, NativeMethods.MONITOR_DEFAULTTONEAREST); var info = new NativeMethods.MONITORINFO { cbSize = Marshal.SizeOf(typeof(NativeMethods.MONITORINFO)) }; - if (!NativeMethods.GetMonitorInfo(monitor, ref info)) - return SystemParameters.WorkArea; - - var fromDevice = GetFromDevice(window); - var topLeft = fromDevice.Transform(new Point(info.rcMonitor.Left, info.rcMonitor.Top)); - var bottomRight = fromDevice.Transform(new Point(info.rcMonitor.Right, info.rcMonitor.Bottom)); - - return new Rect(topLeft, bottomRight); + NativeMethods.GetMonitorInfo(monitor, ref info); + return ToRect(info.rcMonitor); } - private static Matrix GetFromDevice(Window window) => - PresentationSource.FromVisual(window)?.CompositionTarget?.TransformFromDevice ?? Matrix.Identity; + private static Rect ToRect(NativeMethods.RECT rect) => + new(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top); private static class NativeMethods { public const uint MONITOR_DEFAULTTONEAREST = 2; + public const uint SWP_NOSIZE = 0x0001; + public const uint SWP_NOZORDER = 0x0004; + public const uint SWP_NOACTIVATE = 0x0010; [StructLayout(LayoutKind.Sequential)] public struct RECT @@ -134,5 +144,8 @@ public struct MONITORINFO [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr hwnd, out RECT rect); + + [DllImport("user32.dll")] + public static extern bool SetWindowPos(IntPtr hwnd, IntPtr insertAfter, int x, int y, int cx, int cy, uint flags); } } diff --git a/Network Monitor/app.manifest b/Network Monitor/app.manifest new file mode 100644 index 0000000..65e747c --- /dev/null +++ b/Network Monitor/app.manifest @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + PerMonitorV2 + + + \ No newline at end of file diff --git a/README.md b/README.md index 44ff852..7494b4f 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Hover for a 60-second sparkline and the stats behind it: min/avg/max, jitter, pa - **Light, dark, or auto:** pick a theme, or let Auto follow the Windows light/dark mode and accent color. - **Resize instantly:** drag the size slider, or hold **Ctrl** and scroll over the widget to scale it. - **Stays where you want:** keep it on top of other windows, drag it anywhere, and it remembers where you left it. +- **Sharp on every monitor:** stays crisp on monitors with different scaling, like a laptop beside a monitor. - **Copy on demand:** double-click, or right-click → **Copy**, to grab the current numbers. - **Starts with Windows:** optionally launch on sign-in, and check for updates in one click from the menu. - **Honest outages:** when pings stop, a clock counts the time since the last reply; hover for when it started.