Use :
HANDLE start_img = LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(103), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE);
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello there! I am trying to load an image from the resources here's my code which is not working:
the resource.h:
#define IDB_BITMAP1 103
the main source code:
HANDLE start_img = LoadImage(NULL, MAKEINTRESOURCE(103), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE);
if (start_img == NULL)
{
return 0;
}
However, the file path instead of MAKEINTRESOURCE is working. Here's the code:
HANDLE start_img = LoadImage(NULL, L"C:\\Users\\_resun\\Desktop\\play.bmp", IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE);
can someone please help me?
Thank you.
Use :
HANDLE start_img = LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(103), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE);