Marin
Marin

Reputation: 1331

FindResource PNG fails?

I am trying to use FindResource to get a handle to a PNG in my .rc file, but it always fails with 1814 - name not found. PNG is certainly in the .rc, its line is:

IDB_PNG1                PNG                     "Resources\\116.png"

And I am trying to load it using

HRSRC hResource = FindResource(GetModuleHandle(NULL), TEXT("IDB_PNG1"), TEXT("PNG")); 

but it always gives a NULL.

Any ideas?

Thanks..

Upvotes: 1

Views: 1252

Answers (2)

Hans Passant
Hans Passant

Reputation: 941970

FindResource(.., TEXT("IDB_PNG1"), ...); 

That's wrong, the ID is a number, not a string. Use MAKEINTRESOURCE(IDB_PNG1).

Upvotes: 4

Marin
Marin

Reputation: 1331

FindResourceEx had to be used and Neutral language explicitly set.

Upvotes: 0

Related Questions