Add Open File DIalog (WIP)
This commit is contained in:
parent
1018454f2e
commit
3518004266
|
@ -21,6 +21,46 @@ namespace SHADE
|
||||||
|
|
||||||
std::vector<std::string> SHWinDialog::DisplayOpenDialog(OpenSaveConfig const& openSaveConfig)
|
std::vector<std::string> SHWinDialog::DisplayOpenDialog(OpenSaveConfig const& openSaveConfig)
|
||||||
{
|
{
|
||||||
|
const HWND hwnd = GetDesktopWindow();
|
||||||
|
HRESULT hResult = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
|
if(SUCCEEDED(hResult))
|
||||||
|
{
|
||||||
|
IFileOpenDialog* pFileOpen;
|
||||||
|
|
||||||
|
//Create Dialog object
|
||||||
|
hResult = CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_ALL, IID_IFileOpenDialog, reinterpret_cast<LPVOID*>(pFileOpen));
|
||||||
|
|
||||||
|
if(SUCCEEDED(hResult))
|
||||||
|
{
|
||||||
|
//Show the open dialog box
|
||||||
|
hResult = pFileOpen->Show(hwnd);
|
||||||
|
|
||||||
|
//Get file name from the dialoh box
|
||||||
|
if(SUCCEEDED(hResult))
|
||||||
|
{
|
||||||
|
if(openSaveConfig.openMultiple)
|
||||||
|
{
|
||||||
|
IShellItemArray* pItemArray;
|
||||||
|
hResult = pFileOpen->GetResults(&pItemArray);
|
||||||
|
if(SUCCEEDED(hResult))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IShellItem* pItem;
|
||||||
|
hResult = pFileOpen->GetResult(&pItem);
|
||||||
|
if(SUCCEEDED(hResult))
|
||||||
|
{
|
||||||
|
PWSTR pszFilePath;
|
||||||
|
hResult = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace SHADE
|
||||||
|
|
||||||
std::string title = "Open";
|
std::string title = "Open";
|
||||||
bool openFolders = false;
|
bool openFolders = false;
|
||||||
|
bool openMultiple = false;
|
||||||
FilterList filterList{};
|
FilterList filterList{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue