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. Loading a CBitmap directly from file system without requiring ::LoadBitmap

Loading a CBitmap directly from file system without requiring ::LoadBitmap

Scheduled Pinned Locked Moved C / C++ / MFC
learningcomgraphicstutorialquestion
3 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.
  • A Offline
    A Offline
    Ahmed Charfeddine
    wrote on last edited by
    #1

    Hi there, I have to fill CImageList with bitmaps. Each bitmap represent a flag of a country. To do this one normally adds the bitmap files as resource, then :

    CImageList allFlagsList;

    CBitmap flagUSA;
    flagUSA.LoadBitmap(IDFlagUSA);

    allFlagsList.Add(flagUSA);

    CBitmap flagFrance;
    flagFrance.LoadBitmap(IDFlagFrance);

    allFlagsList.Add(flagFrance);

    ..etc

    Of course it becomes tedious to do this for all flags ( actually I already did it but want to refactor it for sake of my code!). However I can't find a way how to load a bmp image directly into a CBitmap object. Anyone knows ? Thanks in advance.

    Push Framework - now released ! http://www.pushframework.com

    L 1 Reply Last reply
    0
    • A Ahmed Charfeddine

      Hi there, I have to fill CImageList with bitmaps. Each bitmap represent a flag of a country. To do this one normally adds the bitmap files as resource, then :

      CImageList allFlagsList;

      CBitmap flagUSA;
      flagUSA.LoadBitmap(IDFlagUSA);

      allFlagsList.Add(flagUSA);

      CBitmap flagFrance;
      flagFrance.LoadBitmap(IDFlagFrance);

      allFlagsList.Add(flagFrance);

      ..etc

      Of course it becomes tedious to do this for all flags ( actually I already did it but want to refactor it for sake of my code!). However I can't find a way how to load a bmp image directly into a CBitmap object. Anyone knows ? Thanks in advance.

      Push Framework - now released ! http://www.pushframework.com

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I'm not sure I understand your question, but if you are trying to load a bitmap from a file you can use LoadImage()[^].

      Just say 'NO' to evaluated arguments for diadic functions! Ash

      A 1 Reply Last reply
      0
      • L Lost User

        I'm not sure I understand your question, but if you are trying to load a bitmap from a file you can use LoadImage()[^].

        Just say 'NO' to evaluated arguments for diadic functions! Ash

        A Offline
        A Offline
        Ahmed Charfeddine
        wrote on last edited by
        #3

        Thx for your will to help. That's what I was relying on, but this way I needed to get all flags in the resources which was tedious. I found this which solves my issue and maybe the one who would encontere the same situation : http://www.codeguru.com/cpp/g-m/bitmap/article.php/c1707

        Push Framework - now released ! http://www.pushframework.com

        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