mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[OOBE]Fix msgMonitor to prevent window maximizing (#31136)
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.Settings.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// An empty window that can be used on its own or navigated to within a Frame.
|
/// An empty window that can be used on its own or navigated to within a Frame.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class OobeWindow : WindowEx
|
public sealed partial class OobeWindow : WindowEx, IDisposable
|
||||||
{
|
{
|
||||||
private PowerToysModules initialModule;
|
private PowerToysModules initialModule;
|
||||||
|
|
||||||
@@ -31,6 +31,8 @@ namespace Microsoft.PowerToys.Settings.UI
|
|||||||
private WindowId _windowId;
|
private WindowId _windowId;
|
||||||
private IntPtr _hWnd;
|
private IntPtr _hWnd;
|
||||||
private AppWindow _appWindow;
|
private AppWindow _appWindow;
|
||||||
|
private WindowMessageMonitor _msgMonitor;
|
||||||
|
private bool disposedValue;
|
||||||
|
|
||||||
public OobeWindow(PowerToysModules initialModule)
|
public OobeWindow(PowerToysModules initialModule)
|
||||||
{
|
{
|
||||||
@@ -59,8 +61,8 @@ namespace Microsoft.PowerToys.Settings.UI
|
|||||||
|
|
||||||
this.initialModule = initialModule;
|
this.initialModule = initialModule;
|
||||||
|
|
||||||
var msgMonitor = new WindowMessageMonitor(this);
|
_msgMonitor = new WindowMessageMonitor(this);
|
||||||
msgMonitor.WindowMessageReceived += (_, e) =>
|
_msgMonitor.WindowMessageReceived += (_, e) =>
|
||||||
{
|
{
|
||||||
const int WM_NCLBUTTONDBLCLK = 0x00A3;
|
const int WM_NCLBUTTONDBLCLK = 0x00A3;
|
||||||
if (e.Message.MessageId == WM_NCLBUTTONDBLCLK)
|
if (e.Message.MessageId == WM_NCLBUTTONDBLCLK)
|
||||||
@@ -132,5 +134,22 @@ namespace Microsoft.PowerToys.Settings.UI
|
|||||||
mainWindow.CloseHiddenWindow();
|
mainWindow.CloseHiddenWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (!disposedValue)
|
||||||
|
{
|
||||||
|
_msgMonitor?.Dispose();
|
||||||
|
|
||||||
|
disposedValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||||
|
Dispose(disposing: true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user