mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +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>
|
||||
/// An empty window that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeWindow : WindowEx
|
||||
public sealed partial class OobeWindow : WindowEx, IDisposable
|
||||
{
|
||||
private PowerToysModules initialModule;
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace Microsoft.PowerToys.Settings.UI
|
||||
private WindowId _windowId;
|
||||
private IntPtr _hWnd;
|
||||
private AppWindow _appWindow;
|
||||
private WindowMessageMonitor _msgMonitor;
|
||||
private bool disposedValue;
|
||||
|
||||
public OobeWindow(PowerToysModules initialModule)
|
||||
{
|
||||
@@ -59,8 +61,8 @@ namespace Microsoft.PowerToys.Settings.UI
|
||||
|
||||
this.initialModule = initialModule;
|
||||
|
||||
var msgMonitor = new WindowMessageMonitor(this);
|
||||
msgMonitor.WindowMessageReceived += (_, e) =>
|
||||
_msgMonitor = new WindowMessageMonitor(this);
|
||||
_msgMonitor.WindowMessageReceived += (_, e) =>
|
||||
{
|
||||
const int WM_NCLBUTTONDBLCLK = 0x00A3;
|
||||
if (e.Message.MessageId == WM_NCLBUTTONDBLCLK)
|
||||
@@ -132,5 +134,22 @@ namespace Microsoft.PowerToys.Settings.UI
|
||||
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