From 7abf9baf38e624fefd7554b4841128aa472e2e79 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 25 Mar 2018 14:18:31 -0700 Subject: [PATCH] SDL: Use wstrings in Windows API calls. --- SDL/SDLMain.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 9cd5af04a9..83c656522f 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -218,7 +218,8 @@ int getDisplayNumber(void) { void SystemToast(const char *text) { #ifdef _WIN32 - MessageBox(0, text, "Toast!", MB_ICONINFORMATION); + std::wstring str = ConvertUTF8ToWString(text); + MessageBox(0, str.c_str(), L"Toast!", MB_ICONINFORMATION); #else puts(text); #endif @@ -256,7 +257,8 @@ void LaunchBrowser(const char *url) { #if defined(MOBILE_DEVICE) ILOG("Would have gone to %s but LaunchBrowser is not implemented on this platform", url); #elif defined(_WIN32) - ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL); + std::wstring wurl = ConvertUTF8ToWString(url); + ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL); #elif defined(__APPLE__) std::string command = std::string("open ") + url; system(command.c_str()); @@ -273,7 +275,8 @@ void LaunchMarket(const char *url) { #if defined(MOBILE_DEVICE) ILOG("Would have gone to %s but LaunchMarket is not implemented on this platform", url); #elif defined(_WIN32) - ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL); + std::wstring wurl = ConvertUTF8ToWString(url); + ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL); #elif defined(__APPLE__) std::string command = std::string("open ") + url; system(command.c_str()); @@ -290,7 +293,8 @@ void LaunchEmail(const char *email_address) { #if defined(MOBILE_DEVICE) ILOG("Would have opened your email client for %s but LaunchEmail is not implemented on this platform", email_address); #elif defined(_WIN32) - ShellExecute(NULL, "open", (std::string("mailto:") + email_address).c_str(), NULL, NULL, SW_SHOWNORMAL); + std::wstring mailto = std::wstring(L"mailto:") + ConvertUTF8ToWString(email_address); + ShellExecute(NULL, L"open", mailto.c_str(), NULL, NULL, SW_SHOWNORMAL); #elif defined(__APPLE__) std::string command = std::string("open mailto:") + email_address; system(command.c_str());