c++windowssfx

FindResource fails


I have a piece of code like this

  IDB_PNG1                PNG                     "images\\list-back.png"
  HRSRC hrsrc = FindResource(module, MAKEINTRESOURCE(IDB_PNG1), TEXT("PNG")); 

this works fine,
But I can not make it work any of the variants below

  hrsrc = ::FindResource(module, L"images\\list-back.png", L"PNG");
  hrsrc = ::FindResource(module, L"images\\list-back", L"PNG");
  hrsrc = ::FindResource(module, L"list-back.png", L"PNG");
  hrsrc = ::FindResource(module, L"list-back", L"PNG");

GetlastError returns 0x00000716 The specified resource name cannot be found in the image file.
What is the right string format/ way for searching with a string ?

Edit: .rc will be generated and will contain .html and .png files. I want to be able to locate and Load that files without recompiling the exe. I need to be able to identify somehow in .html what .png is using, in exe I will receive that path/id than FindResource and loading. Can this be done ?


Solution

  • The first entry in a RCDATA line is the name (or ID). The last entry simply is "what should the resource compiler use to create this entry" - the name isn't stored in the executable.

    FOO  RCDATA  "images\\list-back.png"
    
    ...
    
    ::FindResource(module, L"FOO", RT_RCDATA);