Skip to content
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
4 changes: 2 additions & 2 deletions AssetRipper.NativeDialogs/OpenFileDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static class OpenFileDialog
{
OPENFILENAMEW ofn = default;
ofn.lStructSize = (uint)Unsafe.SizeOf<OPENFILENAMEW>();
ofn.hwndOwner = default; // No owner window.
ofn.hwndOwner = Windows.GetConsoleWindow(); // Use console window as owner to ensure dialog comes to foreground
ofn.lpstrFile = bufferPtr;
ofn.nMaxFile = (uint)buffer.Length;
ofn.lpstrFilter = filterPtr;
Expand Down Expand Up @@ -119,7 +119,7 @@ public static class OpenFileDialog
{
OPENFILENAMEW ofn = default;
ofn.lStructSize = (uint)Unsafe.SizeOf<OPENFILENAMEW>();
ofn.hwndOwner = default; // No owner window.
ofn.hwndOwner = Windows.GetConsoleWindow(); // Use console window as owner to ensure dialog comes to foreground
ofn.lpstrFile = bufferPtr;
ofn.nMaxFile = (uint)buffer.Length;
ofn.lpstrFilter = filterPtr;
Expand Down
10 changes: 6 additions & 4 deletions AssetRipper.NativeDialogs/OpenFolderDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ public static class OpenFolderDialog
pFileDialog->GetOptions(&dwOptions);
pFileDialog->SetOptions(dwOptions | (uint)FILEOPENDIALOGOPTIONS.FOS_PICKFOLDERS | (uint)FILEOPENDIALOGOPTIONS.FOS_FORCEFILESYSTEM);

// Show the dialog
hr = pFileDialog->Show(default);
// Show the dialog with console window as owner to ensure it comes to foreground
HWND hwndOwner = Windows.GetConsoleWindow();
hr = pFileDialog->Show(hwndOwner);
if (Windows.SUCCEEDED(hr))
{
IShellItem* pItem;
Expand Down Expand Up @@ -221,8 +222,9 @@ public static class OpenFolderDialog

string[]? result = null;

// Show the dialog
hr = pFileDialog->Show(default);
// Show the dialog with console window as owner to ensure it comes to foreground
HWND hwndOwner = Windows.GetConsoleWindow();
hr = pFileDialog->Show(hwndOwner);
if (Windows.SUCCEEDED(hr))
{
IShellItemArray* pItemArray;
Expand Down
2 changes: 1 addition & 1 deletion AssetRipper.NativeDialogs/SaveFileDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static class SaveFileDialog
{
OPENFILENAMEW ofn = default;
ofn.lStructSize = (uint)Unsafe.SizeOf<OPENFILENAMEW>();
ofn.hwndOwner = default; // No owner window.
ofn.hwndOwner = Windows.GetConsoleWindow(); // Use console window as owner to ensure dialog comes to foreground
ofn.lpstrFile = bufferPtr;
ofn.nMaxFile = (uint)buffer.Length;
ofn.lpstrFilter = filterPtr;
Expand Down