(Mingw - WinXP)
I've been having trouble with this for awhile, it seems my program just refuses to load this .bmp file. I'm not sure if its a bad resource or bad code...
Can anyone see why this doesnt load? (This is mostly the forgers tutorial with some adjustments.
Resource.rc compiled into Resource.o sucessfully.Code://Resource.rc IDB_BALL BITMAP DISCARDABLE "C:\\ball.bmp"
Rpg.cpp compiled into Rpg.o sucessfullyCode://Rpg.cpp //Message loop, only part dealing with the bmp. // Included elsewhere #define IDB_BALL 1 switch(msg) { case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: DeleteObject(ScreenDisplay_Object); PostQuitMessage(0); break; case WM_CREATE: ScreenDisplay_Object = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BALL)); if(ScreenDisplay_Object == NULL) MessageBox(hwnd, "Could not load object!", "Error", MB_OK | MB_ICONEXCLAMATION); break; case WM_PAINT: { BITMAP bm; PAINTSTRUCT ps; HDC hdc = BeginPaint(hwnd, &ps); // 31 HDC hdcMem = CreateCompatibleDC(hdc); HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, ScreenDisplay_Object); //34 GetObject(ScreenDisplay_Object, sizeof(bm), &bm); BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY); SelectObject(hdcMem, hbmOld); DeleteDC(hdcMem); EndPaint(hwnd, &ps); } break; default: return DefWindowProc(hwnd, msg, wParam, lParam); }
Mingw compiles sucessfully, nothing goes wrong, but the bmp just doesnt load. Does anyone see why? >.>Code:$ g++ -o C:/Rpg.exe C:\\Rpg.o C:\\Resource.o -mwindows



LinkBack URL
About LinkBacks



.