Hey! Smart people! My luck has run out. MSDN, cplusplus, StackOverflow, and various other sites can’t seem to help me. (>_<)
Here goes: I have bitmap resources embedded in my x86 executable. I have them properly defined as resources. I have very similar code in another project for WinCE6. But, when I try to load my image resources, I keep getting error 1814(0x716)! (._.)
resources.rc
#include "resources.h" IDB_BITMAP1 BITMAP "tpcn.bmp" IDB_BITMAP2 BITMAP "red.bmp" IDB_BITMAP3 BITMAP "blu.bmp" IDB_BITMAP4 BITMAP "grn.bmp" IDB_BITMAP5 BITMAP "pat.bmp"
resources.h
#ifndef RESOURCES_H #define RESOURCES_H #ifndef IDC_STATIC #define IDC_STATIC -1 #endif #define IDI_CSICO 101 #define IDB_BITMAP1 201 #define IDB_BITMAP2 202 #define IDB_BITMAP3 203 #define IDB_BITMAP4 204 #define IDB_BITMAP5 205 #endif // RESOURCES_H
The snippet of code that fails. (T_T)
HBITMAP image = (HBITMAP)LoadImage(NULL, MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); if (image == NULL) printf("Failure Loading Bitmap %i", GetLastError());
I’m using GNU GCC as my compiler. It does compile. It does run. But, it does always print that “Failure” line I stuck in there. (._.)
Update:
The peeps at SLU gave me a line that works! =^-^=
HBITMAP image = (HBITMAP)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);