C++ addPicture2 from a resource fails

Excellent tip, thank you!
For anyone with the same problem, this works:

HRSRC hResource = FindResource(nullptr, L"resourceName", L"JPG");
size_t _size = SizeofResource(nullptr, hResource);
HGLOBAL hMemory = LoadResource(nullptr, hResource);
LPVOID ptr = LockResource(hMemory);

const char* cArr = static_cast<char*>(hMemory);
int logoId = book->addPicture2(cArr, _size);

with an entrance in the project´s .rc file

resourceName          JPG                     "C:\\path\\to\\file\\imageFile.jpg"
2 Likes