Thread: LoadBitmap function call is constantly failing for some reason

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    195

    LoadBitmap function call is constantly failing for some reason

    This is my code so far for trying to load a few bitmaps into my program, although at the moment, it's not going well, lol. For some reason, the function calls to LoadBitmap are constantly failing, and I can't find where the problem is.

    In my main.cpp file:
    Code:
    case WM_CREATE:
                    // Create handles for the bitmaps. These will be used in the Button replace function
                    hbmCross = LoadBitmap(hThisInstance, "ID_BMP_CROSS");
                    hbmNaught = LoadBitmap(hThisInstance, "ID_BMP_NAUGHT");
                    if(!hbmCross || !hbmNaught) {
                              sprintf(Info.buffer, "Could not load resources from file");
                              MessageBox(hwnd, Info.buffer, "Error Loading Resources", MB_ICONERROR);
                              SendMessage(hwnd, WM_DESTROY, 0, 0);
                              return -1;
                              }
    The important line is the LoadBitmap function calls, since these are the one(s) which are always failing.

    included in my images.rc file:
    Code:
    /* images.rc which contains the IDs for the image files used */
    ID_BMP_CROSS BITMAP "cross.bmp"
    ID_BMP_NAUGHT BITMAP "naught.bmp"
    I've added my images.rc file to the project. At first, I thought that the problem was different names used in the program, from the names of the files in the directory, but that's still not working. I'm out of ideas as to what the problem might be.

    [edit]I've also tried using MAKEINTRESOURCE, but that didn't work either[/edit]
    Last edited by Swarvy; 09-10-2008 at 06:30 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 08:28 AM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  3. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  5. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM