I'm trying to load a BMP image in. At first I was trying to load an external file but after repeated failures I switched to trying to load a predefined bitmap. All attempts with the predefined return with error 1814 (ERROR_RESOURCE_NAME_NOT_FOUND) when trying to load. When doing my own I get error 1812 (ERROR_RESOURCE_DATA_NOT_FOUND). File I'm trying to load:
http://www.mikemill.org/images/directions.bmp
As a side note: I have tried to use LoadImage() but when I try to do something like hBmp = LoadImage (......); I get an error when compiling saying "ANSI C++ forbids implicit conversion from `void *' in assignment"Code:LRESULT CALLBACK WndProcMap (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static HBITMAP hBmp; int c1,c2, tmp; static int x, y; HINSTANCE hInstance; TCHAR szBuffer[100]; switch (message) { case WM_CREATE: if ( SetCurrentDirectory("c:\\game\\wingame\\pic") == 0) {tmp = GetLastError();MessageBoxPrintf( TEXT ("Error"),TEXT ("Set Directory Error Number: %i"), tmp);} hInstance = (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE); if ( (tmp=SearchPath (NULL, TEXT("directions"), TEXT(".bmp"), 100, szBuffer, NULL)) == 0) {tmp = GetLastError();MessageBoxPrintf( TEXT ("Error"),TEXT ("Find File Error Number: %i"), tmp);} MessageBoxPrintf( TEXT ("String"),TEXT ("String %d: %s"), tmp, szBuffer); if ( (hBmp = LoadBitmap(hInstance, szBuffer)) ==NULL) {tmp = GetLastError();MessageBoxPrintf( TEXT ("Error"),TEXT ("Load BMP Error Number: %i"), tmp);} return 0; case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint (hwnd, &ps); HDC hdcMem = CreateCompatibleDC (hdc); SelectObject(hdcMem, hBmp); if (BitBlt (hdc, 100, 100, 30, 30, hdcMem, 0, 0, SRCCOPY) == 0) {tmp = GetLastError();MessageBoxPrintf( TEXT ("Error"),TEXT ("Button Error Number: %i"), tmp);} EndPaint (hwnd, &ps); DeleteObject(hdcMem); } return 0; case WM_DESTROY: PostQuitMessage (0); return 0; case WM_SIZE: x = LOWORD (lParam); y = HIWORD (lParam); return 0; } return DefWindowProc (hwnd, message, wParam, lParam); }



LinkBack URL
About LinkBacks


