AfxGetInstanceHandle()
gives you the HINSTANCE
of the running executable. This means that your LoadStringW
call will be looking in the exe's resource table for your string, which will fail, as the strings are in your DLL.
Instead, you'll need to grab the HINSTANCE
of the DLL itself - this is provided as the first parameter to DllMain()
in your DLL.
See this answer for an example: https://stackoverflow.com/a/2396380/1073843
EDIT:
If you're using an MFC DLL, then it's possible you just need to add a call to AFX_MANAGE_STATE(AfxGetStaticModuleState());
at the top of any entry points into your DLL (before AfxGetInstanceHandle()
is called.)