Problems with LoadBitmap()
Hi guys I am using Bloodshed Dev C++ 4 having real trouble with the LoadBitmap() function. I have been to the thread titled:
C Board - Super-Newbie. Need to see how to use LoadBitmap() correctly?
And consequently I have tried the following:
This one didnít compile giving a parse error on the lines beginning with HINSTANCE and hbmrocket.
HINSTANCE hInstance = GetWindowLong(hwnd, GWL_HINSTANCE);
hbmrocket = LoadBitmap(hInstance, "myBitmap");
//rest of code
myBitmap BITMAP "C:/Games/civ2-tot/civ/Original/23imp.bmp"
This one compiles but does not paint the bitmap or show the message box.
HBITMAP hbmrocket = NULL;
hbmrocket = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_ROCKET));
if(hbmrocket == NULL)
MessageBox(hwnd, "Could not load myBitmap!", "Error", MB_OK | MB_ICONEXCLAMATION);
IDD_ROCKET BITMAP "C:/Games/civ2-tot/civ/Original/65imp.bmp"
myBitmap BITMAP "C:/Games/civ2-tot/civ/Original/65imp.bmp"
and IDD_ROCKET is #defined correctly in a header file (it compiles so no error there).
In both cases, my WM_PAINT case is as follows:
Is anyone able to see what the problem is and give an answer? If so I would be most grateful.
HDC hdc = BeginPaint(hwnd, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);
GetObject(hbmrocket, sizeof(bm), &bm);
BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);