Use desktop-hwnd as directorydialog-owner, fixes #6198

Restore the mainwindow after the dialog. Correctly cleanup COM memory.
This commit is contained in:
Tomas Dittmann authored and Michael Steenbeek committed 2017-08-22 23:07:36 +02:00
1 parent 5089dbe0c9
commit 841bc52027
1 file changed
+6 -1
+6 -1
View File
@@ -164,7 +164,6 @@ namespace OpenRCT2 { namespace Ui
{
std::wstring titleW = String::ToUtf16(title);
BROWSEINFOW bi = { 0 };
bi.hwndOwner = GetHWND(window);
bi.lpszTitle = titleW.c_str();
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE | BIF_NONEWFOLDERBUTTON;
@@ -173,12 +172,18 @@ namespace OpenRCT2 { namespace Ui
{
result = String::ToUtf8(SHGetPathFromIDListLongPath(pidl));
}
CoTaskMemFree(pidl);
}
else
{
log_error("Error opening directory browse window");
}
CoUninitialize();
// SHBrowseForFolderW might minimize the main window,
// so make sure that it's visible again.
ShowWindow(GetHWND(window), SW_RESTORE);
return result;
}