Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Bitmap Resource Loading

Bitmap Resource Loading

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpgraphicsquestionlearning
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gx44
    wrote on last edited by
    #1

    Hi there ! I want to load a bitmap from inside my application in order to display it on a dialog box ! In "resource.h" file i wrote: "#define IDB_BITMAP_SPLASH 500" In "resource.rc" file i wrote: "IDB_BITMAP_SPLASH BITMAP "SPLASH.BMP", where SPLASH.BMP is the name of my bitmap file. In "main.cpp" file i wrote: "HBITMAP hBitmap=(HBITMAP)LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP_SPLASH));", where "hInst" is my application's instance handle. The problem is that this function is returning NULL. I've also tried with "LoadImage()" and "LoadResource()" functions. None of them work ! I've tried instead of MAKEINTRESOURCE to simply write "Splash.bmp" as if i were loading it directly from the file. Does not work ! Can anyone help me :confused:? I'm using Windows 2000 SP4 and i'm not writing this in MFC, but in simple Win32API. ThankYou :)!!!

    R J G 3 Replies Last reply
    0
    • G gx44

      Hi there ! I want to load a bitmap from inside my application in order to display it on a dialog box ! In "resource.h" file i wrote: "#define IDB_BITMAP_SPLASH 500" In "resource.rc" file i wrote: "IDB_BITMAP_SPLASH BITMAP "SPLASH.BMP", where SPLASH.BMP is the name of my bitmap file. In "main.cpp" file i wrote: "HBITMAP hBitmap=(HBITMAP)LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP_SPLASH));", where "hInst" is my application's instance handle. The problem is that this function is returning NULL. I've also tried with "LoadImage()" and "LoadResource()" functions. None of them work ! I've tried instead of MAKEINTRESOURCE to simply write "Splash.bmp" as if i were loading it directly from the file. Does not work ! Can anyone help me :confused:? I'm using Windows 2000 SP4 and i'm not writing this in MFC, but in simple Win32API. ThankYou :)!!!

      R Offline
      R Offline
      rocky_pulley
      wrote on last edited by
      #2

      Can you view the splash.bmp from the resource editor? -- Rocky Dean Pulley -- DreamSys Software -- http://www.dreamsyssoft.com

      G 1 Reply Last reply
      0
      • G gx44

        Hi there ! I want to load a bitmap from inside my application in order to display it on a dialog box ! In "resource.h" file i wrote: "#define IDB_BITMAP_SPLASH 500" In "resource.rc" file i wrote: "IDB_BITMAP_SPLASH BITMAP "SPLASH.BMP", where SPLASH.BMP is the name of my bitmap file. In "main.cpp" file i wrote: "HBITMAP hBitmap=(HBITMAP)LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP_SPLASH));", where "hInst" is my application's instance handle. The problem is that this function is returning NULL. I've also tried with "LoadImage()" and "LoadResource()" functions. None of them work ! I've tried instead of MAKEINTRESOURCE to simply write "Splash.bmp" as if i were loading it directly from the file. Does not work ! Can anyone help me :confused:? I'm using Windows 2000 SP4 and i'm not writing this in MFC, but in simple Win32API. ThankYou :)!!!

        J Offline
        J Offline
        Jose Lamas Rios
        wrote on last edited by
        #3

        ThEdreamMaker wrote: "HBITMAP hBitmap=(HBITMAP)LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP_SPLASH));", where "hInst" is my application's instance handle. The problem is that this function is returning NULL Have you checked GetLastError()? -- jlr http://jlamas.blogspot.com/[^]

        G 1 Reply Last reply
        0
        • R rocky_pulley

          Can you view the splash.bmp from the resource editor? -- Rocky Dean Pulley -- DreamSys Software -- http://www.dreamsyssoft.com

          G Offline
          G Offline
          gx44
          wrote on last edited by
          #4

          I use Bloodshed Dev-C++ IDE with MINGW compiler, so i don't have a resource editor !

          1 Reply Last reply
          0
          • J Jose Lamas Rios

            ThEdreamMaker wrote: "HBITMAP hBitmap=(HBITMAP)LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP_SPLASH));", where "hInst" is my application's instance handle. The problem is that this function is returning NULL Have you checked GetLastError()? -- jlr http://jlamas.blogspot.com/[^]

            G Offline
            G Offline
            gx44
            wrote on last edited by
            #5

            GetLastError() returns 1814, and FormatMessage() for this error number says: "The specified resource name cannot be found in the image file." :((

            1 Reply Last reply
            0
            • G gx44

              Hi there ! I want to load a bitmap from inside my application in order to display it on a dialog box ! In "resource.h" file i wrote: "#define IDB_BITMAP_SPLASH 500" In "resource.rc" file i wrote: "IDB_BITMAP_SPLASH BITMAP "SPLASH.BMP", where SPLASH.BMP is the name of my bitmap file. In "main.cpp" file i wrote: "HBITMAP hBitmap=(HBITMAP)LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP_SPLASH));", where "hInst" is my application's instance handle. The problem is that this function is returning NULL. I've also tried with "LoadImage()" and "LoadResource()" functions. None of them work ! I've tried instead of MAKEINTRESOURCE to simply write "Splash.bmp" as if i were loading it directly from the file. Does not work ! Can anyone help me :confused:? I'm using Windows 2000 SP4 and i'm not writing this in MFC, but in simple Win32API. ThankYou :)!!!

              G Offline
              G Offline
              gx44
              wrote on last edited by
              #6

              The problem was that hInst was NULL ! Thank you anyway :) !!!!!!! http://gxsoftware.idilis.ro

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups