mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
[Settings]Fix ZoomIt page changing current directory (#37052)
This commit is contained in:
@@ -33,4 +33,10 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
public IntPtr Hook = IntPtr.Zero;
|
||||
public string Template;
|
||||
}
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-openfilenamea
|
||||
public enum OpenFileNameFlags
|
||||
{
|
||||
OFN_NOCHANGEDIR = 0x00000008,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
openFileName.Title = title;
|
||||
openFileName.FilterIndex = initialFilter;
|
||||
openFileName.DefExt = null;
|
||||
openFileName.Flags = (int)OpenFileNameFlags.OFN_NOCHANGEDIR; // OFN_NOCHANGEDIR flag is needed, because otherwise GetOpenFileName overwrites the process working directory.
|
||||
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(App.GetSettingsWindow());
|
||||
openFileName.Hwnd = windowHandle;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user