add import dialog on windows

This commit is contained in:
2017-12-19 00:20:48 +00:00
parent 0d7217af7b
commit b389d895ab
2 changed files with 26 additions and 0 deletions

View File

@@ -81,6 +81,26 @@ void async_unlock()
}
}
std::string win32_open_file()
{
OPENFILENAMEA ofn;
char fileName[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWnd;
ofn.lpstrFilter = "Image Files (*.jpg, *.png)\0*.jpg;*.png";
ofn.lpstrFile = fileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "";
ofn.lpstrInitialDir = "Missions\\";
if (GetOpenFileNameA(&ofn) != NULL)
{
return fileName;
}
return "";
}
struct async_locker
{
async_locker() { async_lock(); }