[Settings]Fix ZoomIt page changing current directory (#37052)
This commit is contained in:
Родитель
eeeabc82c9
Коммит
fb35c93877
|
@ -993,6 +993,7 @@ NNN
|
|||
NOACTIVATE
|
||||
NOAGGREGATION
|
||||
NOASYNC
|
||||
NOCHANGEDIR
|
||||
NOCLIP
|
||||
NOCLOSEPROCESS
|
||||
NOCOALESCE
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче