Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Settings]Fix ZoomIt page changing current directory #37052

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spell-check/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ NNN
NOACTIVATE
NOAGGREGATION
NOASYNC
NOCHANGEDIR
NOCLIP
NOCLOSEPROCESS
NOCOALESCE
Expand Down
6 changes: 6 additions & 0 deletions src/settings-ui/Settings.UI/Helpers/OpenFileName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ public class OpenFileName
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,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private static string PickFileDialog(string filter, string title, string initial
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;

Expand Down
Loading