#51 Load resources with AtlFindResourceInstance

wont-fix
None
5
2014-02-23
2005-12-06
No

Application can store resources in separate resource
only dll. ATL 7.0 has a great feature
_AtlBaseModule.AddResourceInstance and
AtlFindResourceInstance, which helps find resourcec by
type and id in some different modules.
Is it possible to add this method of resource loading
in atluser.h and other
for example:

// old version
::DialogBoxParam(_AtlBaseModule.GetResourceInstance(),
MAKEINTRESOURCE(static_cast<T*>(this)->IDD),
hWndParent, T::StartDialogProc, dwInitParam);

// new vesrion like this:
HINSTANCE hInst =
AtlFindResourceInstance(MAKEINTRESOURCE(static_cast<T*>(this)->IDD),
RT_DIALOG);
::DialogBoxParam(hInst,
MAKEINTRESOURCE(static_cast<T*>(this)->IDD),
hWndParent, T::StartDialogProc, dwInitParam);

It must be usefol for strings, menus, dialogs and other
localizable resources

Discussion

  • This cannot be done in a general way because GetResourceInstance() requires type of the resource as well. So, changes to make this happen would be pretty big, and I don't think that the results would be worth it.

     


Anonymous


Cancel   Add attachments