[Settings]Fix ZoomIt page changing current directory (#37052)
This commit is contained in:
Родитель
eeeabc82c9
Коммит
fb35c93877
|
@ -993,6 +993,7 @@ NNN
|
||||||
NOACTIVATE
|
NOACTIVATE
|
||||||
NOAGGREGATION
|
NOAGGREGATION
|
||||||
NOASYNC
|
NOASYNC
|
||||||
|
NOCHANGEDIR
|
||||||
NOCLIP
|
NOCLIP
|
||||||
NOCLOSEPROCESS
|
NOCLOSEPROCESS
|
||||||
NOCOALESCE
|
NOCOALESCE
|
||||||
|
|
|
@ -33,4 +33,10 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||||
public IntPtr Hook = IntPtr.Zero;
|
public IntPtr Hook = IntPtr.Zero;
|
||||||
public string Template;
|
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.Title = title;
|
||||||
openFileName.FilterIndex = initialFilter;
|
openFileName.FilterIndex = initialFilter;
|
||||||
openFileName.DefExt = null;
|
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());
|
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(App.GetSettingsWindow());
|
||||||
openFileName.Hwnd = windowHandle;
|
openFileName.Hwnd = windowHandle;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче