0

I'm trying to load one graphic resource (PNG image) which seems to be added to my project (I used 'Add item...' with the file placed at the main path).

The function I made is the next:

Image^ Camera::LoadResource( String^ file, String^ Res){
        String^ ressrc = file;      
        System::Reflection::Assembly^ execAssem = System::Reflection::Assembly::GetExecutingAssembly();
        Resources::ResourceManager^ myres = gcnew Resources::ResourceManager(ressrc, execAssem);
        Object^ obj = myres->GetObject(Res);
        return dynamic_cast<Image^>(obj);

    }

But when I check 'obj', it has a null value. This function used to work on another project... what I'm doing wrong this time?

Thank you!

areify
  • 196
  • 1
  • 9
  • You are using the wrong Res string of course. If you have no idea what it should be then look at the assembly manifest with ildasm.exe – Hans Passant Aug 06 '17 at 14:16
  • This is my resource file opened with Visual Studio. It's included at the project, as you can see. And the string I use is "LED_green" https://ibb.co/jVqU6a – areify Aug 07 '17 at 06:49

0 Answers0