c++ - LoadBitmap fails ERROR_RESOURCE_NAME_NOT_FOUND -


i have bitmap defined in resource.h , .rc file:

#define idb_bitmap1                     130 idb_bitmap1             bitmap  discardable     "bitmap1.bmp" 

when try load with

hbmp = loadbitmap(0, makeintresource(idb_bitmap1)); 

it fails, , getlasterror() returns 1814 (or 0x716 in hex), stands error_resource_name_not_found. bitmap there. because of hinstance? thought 0 works if resource in .exe, , is.

it mistake pass 0 instance. documentation says:

an application can use loadbitmap function access predefined bitmaps. so, application must set hinstance parameter null , lpbitmapname parameter 1 of following values.

...... table removed......

you not loading predefined bitmap , need pass instance handle contains resource.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -