mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-02 02:30:21 +00:00
Show internal Win32 error if we use GetOpenFileName Win32 API function incorrectly
This commit is contained in:
parent
6800302d34
commit
30052dbd9e
@ -11,6 +11,7 @@
|
|||||||
#include "she/win/native_dialogs.h"
|
#include "she/win/native_dialogs.h"
|
||||||
|
|
||||||
#include "base/string.h"
|
#include "base/string.h"
|
||||||
|
#include "she/error.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
@ -93,7 +94,22 @@ public:
|
|||||||
ofn.Flags |= OFN_OVERWRITEPROMPT;
|
ofn.Flags |= OFN_OVERWRITEPROMPT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return GetOpenFileName(&ofn) != FALSE;
|
BOOL res;
|
||||||
|
if (m_save)
|
||||||
|
res = GetSaveFileName(&ofn);
|
||||||
|
else
|
||||||
|
res = GetOpenFileName(&ofn);
|
||||||
|
|
||||||
|
if (!res) {
|
||||||
|
DWORD err = CommDlgExtendedError();
|
||||||
|
if (err) {
|
||||||
|
std::vector<char> buf(1024);
|
||||||
|
sprintf(&buf[0], "Error using GetOpen/SaveFileName Win32 API. Code: %d", err);
|
||||||
|
she::error_message(&buf[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res != FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user