Merge pull request #116 from thedax/master

Windows build fix.
This commit is contained in:
Henrik Rydgård committed 2013-08-26 10:23:28 -07:00
commit ff3cc325c8
1 file changed
+6 -6
+6 -6
View File
@@ -8,18 +8,18 @@
// For desktop operating systems only. Stubbed out on Android.
// Simplified as this will only be used in utilities / temp code.
// An false returned means cancel;
bool OpenFileDialog(const char *title, const char *extension, std::string *filename)
bool OpenFileDialog(const wchar_t *title, const wchar_t *extension, std::wstring *filename)
{
OPENFILENAME of;
memset(&of, 0, sizeof(of));
char buffer[512] = {0};
wchar_t buffer[512] = {0};
of.lStructSize = sizeof(OPENFILENAME);
of.hInstance = 0;
of.hwndOwner = GetActiveWindow();
// These weird strings with zeroes in them can't be dealt with using normal string
// functions, so here we go - evil hackery.
char filter[256] = "XXX files\0*.XXX\0\0";
wchar_t filter[256] = L"XXX files\0*.XXX\0\0";
memcpy(filter, extension, 3);
memcpy(filter + 12, extension, 3);
of.lpstrFilter = filter;
@@ -34,18 +34,18 @@ bool OpenFileDialog(const char *title, const char *extension, std::string *filen
return true;
}
bool SaveFileDialog(const char *title, const char *extension, std::string *filename)
bool SaveFileDialog(const wchar_t *title, const wchar_t *extension, std::wstring *filename)
{
OPENFILENAME of;
memset(&of, 0, sizeof(of));
char buffer[512] = {0};
wchar_t buffer[512] = {0};
of.lStructSize = sizeof(OPENFILENAME);
of.hInstance = 0;
of.hwndOwner = GetActiveWindow();
// These weird strings with zeroes in them can't be dealt with using normal string
// functions, so here we go - evil hackery.
char filter[256] = "XXX files\0*.XXX\0\0";
wchar_t filter[256] = L"XXX files\0*.XXX\0\0";
memcpy(filter, extension, 3);
memcpy(filter + 12, extension, 3);
of.lpstrFilter = filter;