Use resource DLL loaded using LoadLibraryEx(..., LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE) with AfxSetResourceHandle
00:14 24 Oct 2025

I'm programming a MFC application that should be internationalized. Currently I'm providing separate language DLLs per architecture (ARM64, x86, x64), but recently I came across ::LoadLibraryEx(langDll, nullptr, LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | LOAD_LIBRARY_AS_IMAGE_RESOURCE); which only loads the resource section of a DLL (maybe it is even better to use LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE instead of LOAD_LIBRARY_AS_DATAFILE).

All the examples from Microsoft use ::LoadLibrary (e.g., https://learn.microsoft.com/en-us/cpp/mfc/tn057-localization-of-mfc-components?view=msvc-170, but are also quite old), but can I a handle retrieved from LoadLibraryEx(..., LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE) with AfxSetResourceHandle?

According to the documentation FindResource, LoadString etc. should work and also my first tests seem to work (also https://stackoverflow.com/a/75766801/3906760 implies it should work, but ChatGPT said it does not work).

I'm asking for usage on Windows 10+.

windows visual-c++ mfc loadlibrary