add file save dialog on win

This commit is contained in:
2019-09-03 08:07:38 +02:00
parent 44bbb02aa1
commit 486d2a4eeb
3 changed files with 66 additions and 0 deletions

View File

@@ -278,6 +278,26 @@ std::string win32_open_file(const char* filter)
return "";
}
std::string win32_save_file(const char* filter)
{
OPENFILENAMEA ofn;
char fileName[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWnd;
ofn.lpstrFilter = filter;
ofn.lpstrFile = fileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
ofn.lpstrDefExt = "";
ofn.lpstrInitialDir = "";
if (GetSaveFileNameA(&ofn) != NULL)
{
return fileName;
}
return "";
}
std::string win32_open_dir()
{
BROWSEINFOA bi;