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. How to load a bitmap from disk?

How to load a bitmap from disk?

Scheduled Pinned Locked Moved C / C++ / MFC
graphicstutorialquestionlearning
2 Posts 2 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.
  • N Offline
    N Offline
    Newbie
    wrote on last edited by
    #1

    How to load a bitmap from the disk (NOT as a resource) to a CBitmap or some other ... to be able to display it or put it in an image control ?

    D 1 Reply Last reply
    0
    • N Newbie

      How to load a bitmap from the disk (NOT as a resource) to a CBitmap or some other ... to be able to display it or put it in an image control ?

      D Offline
      D Offline
      Derek
      wrote on last edited by
      #2

      use this code... CString fileName = "c:\\pics\\picture.bmp"; // this should be a path to the file to load, can also use CFileDialog to get path // this wil load the image from disk into an HBITMAP HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); CBitmap cBmp; // create a CBitmap to hold the image cBmp.Attach(hBmp); // here is the CBItmap that contains the image ================== The original message was: How to load a bitmap from the disk (NOT as a resource) to a CBitmap or some other ... to be able to display it or put it in an image control ?

      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