views:

237

answers:

2

I've been trying to access an image resource named "IndexPointer.jpg" in an embedded RESX file called "Images.resx". GetManifestResourceNames() returns a single value - SCtor.Images.resources".

Assembly::GetExecutingAssembly()->GetManifestResourceStream("SCtor.Images.resources.IndexPointer.jpg")

only returns a nullptr. Obviously, I've got the manifest name wrong. What would be the correct one ?

A: 

Open the assembly with Reflector to find out the correct resource name.

Bruno Martinez
No good - It only shows what I already know, the ResourceName and names of the image resources in it.
shadeMe
A: 

Well, I finally figured it out. Strangely, I recall coming across (and trying out) the working solution and disregarding it. In any case, I instantiated a ResourceManager object with my assembly's resource and used its GetObject method to extract the embedded image.

ResourceManager^ resources = gcnew ResourceManager("<rootNamespace>.<resourceName>", Assembly::GetExecutingAssembly());
Bitmap^ Image1 = gcnew Bitmap(dynamic_cast<Image^>(resources->GetObject("<nameOfTheImageResourceWithoutItsExtension>")));
shadeMe