Thread: Failed to Load Bitmap

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    215

    Failed to Load Bitmap

    Im working on a Win32 program in C, and this function below worked on another program, but it wont work on mine and it just goes down to the error message. Heres the function

    hSplashBMP = LoadBitmap(hInstance, MAKEINTRESOURCE("STP_LOGO_NEW.BMP"));

    if (!hSplashBMP)
    {
    MessageBox(NULL, "Failed To Load Bitmap", "Error", MB_OK | MB_ICONERROR);
    return 0;
    }


    I used the debugger, and it states that hSplashBMP cannot be evaluated. I dont understand why that is. STP_LOGO_NEW.BMP is in the same directory as the program, and i tried putting the entire path, but I got the same thing. anyways, i hope someone can help.

    Thanks

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Post in windows forum next time and remove MAKEINTRESOURCE. That's only for turning an integer resource id into a LPTSTR.

    Also, use GetLastError() if you want gleem any information as to why a Win32 function fails.

    gg

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    215
    I will do that next time. Thanks for replying, however, it still gave me the same response.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    And GetLastError() returned................

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    I know this doesn't help your problem, but LoadBitmap is deprecated. You should use LoadImage instead.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Loading a bitmap (Without using glaux)
    By Shamino in forum Game Programming
    Replies: 7
    Last Post: 03-16-2006, 09:43 AM
  2. Load Bitmap as Window Background
    By Epo in forum Windows Programming
    Replies: 6
    Last Post: 07-19-2005, 09:37 AM
  3. Bitmap Displaying Problem
    By MadCow257 in forum Game Programming
    Replies: 0
    Last Post: 01-25-2005, 05:21 PM
  4. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  5. Why won't my bitmap load
    By ColdFire in forum Windows Programming
    Replies: 4
    Last Post: 07-18-2002, 10:46 PM