Reputation: 12654
Using Visual Studio, I can add a .resx resources file to the unmanaged Visual C++ project. But how can I use it?
It compiles fine, but no resource headers are generated that can be included in source. For the classical RC files, there are headers with resource IDs.
I want to use resx files to have a shared resources, like strings and icons, between managed and unmanaged libraries. The idea was to include the same resx file in both projects.
Upvotes: 3
Views: 2697
Reputation: 942187
You can't. The tooling is missing to translate them from their .resx format to binary .resource files and embed them in the managed assembly manifest. Necessarily so, native C++ projects don't create an assembly.
Use a .rc file instead. Well supported by the C++ IDE, if you don't have one yet then use Project + Add New Item, Resource node, "Resource File (.rc)" template. Double-click the added item to open the resource editor. Load resources at runtime with winapi functions, like LoadString, LoadIcon, etc. If you need to share them with managed code then that code will need to pinvoke those same functions. You might consider duplicating them to avoid that. It doesn't otherwise make a lot of sense to require sharing.
Upvotes: 3