Add instance argument to wxLoadUserResource().
This makes it possible to load resources from other modules than the main executable. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64152 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
1930cbd768
commit
18923e360c
@ -737,7 +737,8 @@ WXDLLIMPEXP_CORE bool wxYieldIfNeeded();
|
||||
wxLoadUserResource(const void **outData,
|
||||
size_t *outLen,
|
||||
const wxString& resourceName,
|
||||
const wxString& resourceType = wxUserResourceStr);
|
||||
const wxString& resourceType = wxUserResourceStr,
|
||||
WXHINSTANCE module = 0);
|
||||
|
||||
// This function allocates a new buffer and makes a copy of the resource
|
||||
// data, remember to delete[] the buffer. And avoid using it entirely if
|
||||
@ -747,7 +748,8 @@ WXDLLIMPEXP_CORE bool wxYieldIfNeeded();
|
||||
WXDLLIMPEXP_BASE char*
|
||||
wxLoadUserResource(const wxString& resourceName,
|
||||
const wxString& resourceType = wxUserResourceStr,
|
||||
int* pLen = NULL);
|
||||
int* pLen = NULL,
|
||||
WXHINSTANCE module = 0);
|
||||
#endif // MSW
|
||||
|
||||
#endif
|
||||
|
@ -1085,17 +1085,18 @@ bool
|
||||
wxLoadUserResource(const void **outData,
|
||||
size_t *outLen,
|
||||
const wxString& resourceName,
|
||||
const wxString& resourceType)
|
||||
const wxString& resourceType,
|
||||
WXHINSTANCE instance)
|
||||
{
|
||||
wxCHECK_MSG( outData && outLen, false, "output pointers can't be NULL" );
|
||||
|
||||
HRSRC hResource = ::FindResource(wxGetInstance(),
|
||||
HRSRC hResource = ::FindResource(instance,
|
||||
resourceName.wx_str(),
|
||||
resourceType.wx_str());
|
||||
if ( !hResource )
|
||||
return false;
|
||||
|
||||
HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource);
|
||||
HGLOBAL hData = ::LoadResource(instance, hResource);
|
||||
if ( !hData )
|
||||
{
|
||||
wxLogSysError(_("Failed to load resource \"%s\"."), resourceName);
|
||||
@ -1109,7 +1110,7 @@ wxLoadUserResource(const void **outData,
|
||||
return false;
|
||||
}
|
||||
|
||||
*outLen = ::SizeofResource(wxGetInstance(), hResource);
|
||||
*outLen = ::SizeofResource(instance, hResource);
|
||||
|
||||
// Notice that we do not need to call neither UnlockResource() (which is
|
||||
// obsolete in Win32) nor GlobalFree() (resources are freed on process
|
||||
@ -1121,11 +1122,12 @@ wxLoadUserResource(const void **outData,
|
||||
char *
|
||||
wxLoadUserResource(const wxString& resourceName,
|
||||
const wxString& resourceType,
|
||||
int* pLen)
|
||||
int* pLen,
|
||||
WXHINSTANCE instance)
|
||||
{
|
||||
const void *data;
|
||||
size_t len;
|
||||
if ( !wxLoadUserResource(&data, &len, resourceName, resourceType) )
|
||||
if ( !wxLoadUserResource(&data, &len, resourceName, resourceType, instance) )
|
||||
return NULL;
|
||||
|
||||
char *s = new char[len + 1];
|
||||
|
Loading…
Reference in New Issue
Block a user