X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cc3445715df75972dae141ab4b3d45f521473ba3..7a0a6cc8f61cb53ce1c76897489e1e363d1a1fa5:/src/msw/utilsgui.cpp?ds=inline diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index 1ee21a2026..68ca45db20 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -108,7 +108,7 @@ bool wxCheckForInterrupt(wxWindow *wnd) // Returns NULL or newly-allocated memory, so use delete[] to clean up. #ifndef __WXMICROWIN__ -wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType) +char *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType, int* pLen /* = NULL */) { HRSRC hResource = ::FindResource(wxGetInstance(), resourceName.wx_str(), @@ -120,15 +120,16 @@ wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourc if ( hData == 0 ) return NULL; - wxChar *theText = (wxChar *)::LockResource(hData); + void *theText = ::LockResource(hData); if ( !theText ) return NULL; // Not all compilers put a zero at the end of the resource (e.g. BC++ doesn't). // so we need to find the length of the resource. - int len = ::SizeofResource(wxGetInstance(), hResource) + 1; - wxChar *s = new wxChar[len]; - wxStrlcpy(s, theText, len); + int len = ::SizeofResource(wxGetInstance(), hResource); + char *s = new char[len + 1]; + memcpy(s, theText, len); + s[len] = '\0'; // NUL-terminate in case the resource itself wasn't // Obsolete in WIN32 #ifndef __WIN32__ @@ -138,6 +139,9 @@ wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourc // No need?? // GlobalFree(hData); + if (pLen) + *pLen = len; + return s; } #endif // __WXMICROWIN__ @@ -372,11 +376,11 @@ extern bool wxEnableFileNameAutoComplete(HWND hwnd) s_initialized = true; wxLogNull nolog; - wxDynamicLibrary dll(_T("shlwapi.dll")); + wxDynamicLibrary dll(wxT("shlwapi.dll")); if ( dll.IsLoaded() ) { s_pfnSHAutoComplete = - (SHAutoComplete_t)dll.GetSymbol(_T("SHAutoComplete")); + (SHAutoComplete_t)dll.GetSymbol(wxT("SHAutoComplete")); if ( s_pfnSHAutoComplete ) { // won't be unloaded until the process termination, no big deal @@ -391,7 +395,7 @@ extern bool wxEnableFileNameAutoComplete(HWND hwnd) HRESULT hr = s_pfnSHAutoComplete(hwnd, 0x10 /* SHACF_FILESYS_ONLY */); if ( FAILED(hr) ) { - wxLogApiError(_T("SHAutoComplete"), hr); + wxLogApiError(wxT("SHAutoComplete"), hr); return false; } @@ -412,7 +416,7 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags) WinStruct sei; sei.lpFile = document.wx_str(); - sei.lpVerb = _T("open"); + sei.lpVerb = wxT("open"); #ifdef __WXWINCE__ sei.nShow = SW_SHOWNORMAL; // SW_SHOWDEFAULT not defined under CE (#10216) #else @@ -437,17 +441,17 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags) bool wxDoLaunchDefaultBrowser(const wxString& url, const wxString& scheme, int flags) { wxUnusedVar(flags); - + #if wxUSE_IPC if ( flags & wxBROWSER_NEW_WINDOW ) { // ShellExecuteEx() opens the URL in an existing window by default so // we can't use it if we need a new window - wxRegKey key(wxRegKey::HKCR, scheme + _T("\\shell\\open")); + wxRegKey key(wxRegKey::HKCR, scheme + wxT("\\shell\\open")); if ( !key.Exists() ) { // try the default browser, it must be registered at least for http URLs - key.SetName(wxRegKey::HKCR, _T("http\\shell\\open")); + key.SetName(wxRegKey::HKCR, wxT("http\\shell\\open")); } if ( key.Exists() ) @@ -507,7 +511,7 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, const wxString& scheme, int f WinStruct sei; sei.lpFile = url.c_str(); - sei.lpVerb = _T("open"); + sei.lpVerb = wxT("open"); sei.nShow = SW_SHOWNORMAL; sei.fMask = SEE_MASK_FLAG_NO_UI; // we give error message ourselves