adding / calling C# code inside my C++ MFC app
> I assume that the (M) means "managed" C++ code.
> How does one add resources to managed C++ code ? This feature
> does not seem to work in vs.NET.
unmanaged resources are the same as before, but for managed resources you do
not have the facilities that C# offers. However, changing your managed C++
projects to have managed resources is quite simple.
The managed resource can be compiled or not, depending on how you want to
read it. If it is not compiled then you need to pass the name of the
resource using the linker /assemblyresource switch (in VC++ project
properties, linker, input, embed managed resource file).
If the resource is compiled (so that you can load it with ResourceManager)
you need to add the source to the project and from its property pages go to
custom build step and in the command line use
resgen $(InputFileName) $(IntDir)/$(InputName).resources
then add the compiled resources (in the intermediate folder) to the linker
You can also create satellite assemblies with C++, but it is more involved
and I won't go into the details here.
Note that there are no tools in VS.NET for C++ projects to add binary
resources to .resx files (the source files for resgen). If you want to add
binary resources (eg icons and cursors) as compiled managed resources, it is
best to do this in a C# project and copy the .resx to the C++ project.
Details of all of this is in my C++ book for MSPress.
Richard Grimes [MVP]
author: "Programming with Managed Extensions for Visual C++ .NET",
the Microsoft Press book about Managed C++