I'm trying to load a bitmap from resource instead of a file location. I'm using visual stuidos and I have imported the same bitmap into the rc. The LoadImage returns a NULL when I try with the resource version. Is my syntax wrong? or am I missing additional steps? Please point me in the right direction I'm trying to learn. Thanks in advance.
HBITMAP mhbitmap;
// Loading from a file works
mhbitmap = (HBITMAP)LoadImage(NULL, L"sblue.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
mpiccontrol.SetBitmap(mhbitmap);
if (mhbitmap == NULL) {
MessageBox(L"null", L"from file", NULL);
}
The load from file version shows the image, but the resource version does not show the image.
mpiccontrol.SetBitmap(mhbitmap);
// My attempt at loading from resource
mhbitmap = (HBITMAP)LoadImage(NULL, MAKEINTRESOURCE("IDB_BITMAP1"), IMAGE_BITMAP, 0, 0, 0);
if (mhbitmap == NULL) {
MessageBox(L"null", L"from rc", NULL);
}
mpiccontrol.SetBitmap(mhbitmap);