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 images dynamically.

How to Load images dynamically.

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
16 Posts 5 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.
  • Y Y K Kishore Kumar

    I want to load an image to a control by downloading it at runtime. Can some body please tell me how to load the image at run time. (i need it for all types of images). Thanks Kishore

    M Offline
    M Offline
    Maximilien
    wrote on last edited by
    #4

    to load the bitmap file use something like : HBITMAP hBitmap = (HBITMAP)::LoadImage(0, lpszFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); (edited to add more text.)


    Maximilien Lincourt Your Head A Splode - Strong Bad

    1 Reply Last reply
    0
    • Y Y K Kishore Kumar

      i want to load a bitmap image from a specified location, at run time. For example: i want to load the image from the file "bitmap1.bmp" saved on desktop to a control on the UI. Kishore

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #5

      Ok, so what's the problem? What code do you have so far?


      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      Y 1 Reply Last reply
      0
      • D David Crow

        Ok, so what's the problem? What code do you have so far?


        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        Y Offline
        Y Offline
        Y K Kishore Kumar
        wrote on last edited by
        #6

        I have no idea how to load the images from a file at run time. please give some sample code. Kishore

        D T 2 Replies Last reply
        0
        • Y Y K Kishore Kumar

          I have no idea how to load the images from a file at run time. please give some sample code. Kishore

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #7

          Y K Kishore Kumar wrote:

          please give some sample code.

          See here.


          "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          1 Reply Last reply
          0
          • Y Y K Kishore Kumar

            I want to load an image to a control by downloading it at runtime. Can some body please tell me how to load the image at run time. (i need it for all types of images). Thanks Kishore

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #8

            If you want to load bmp files you can use of LoadImage but if you want to load other files like jpg you can use of CImage class and then use of a hbitmap for set it to controls.

            T 1 Reply Last reply
            0
            • Y Y K Kishore Kumar

              I want to load an image to a control by downloading it at runtime. Can some body please tell me how to load the image at run time. (i need it for all types of images). Thanks Kishore

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #9

              Y K Kishore Kumar wrote:

              I want to load an image to a control by downloading it at runtime. Can some body please tell me how to load the image at run time. (i need it for all types of images).

              Search for IPictureDisp if you like using COM and search for CEnBitmap class by Dan.G. here.. that would solve your purpose! i feel

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
              Never mind - my own stupidity is the source of every "problem" - Mixture

              cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

              1 Reply Last reply
              0
              • H Hamid Taebi

                If you want to load bmp files you can use of LoadImage but if you want to load other files like jpg you can use of CImage class and then use of a hbitmap for set it to controls.

                T Offline
                T Offline
                ThatsAlok
                wrote on last edited by
                #10

                Hamid. wrote:

                if you want to load other files like jpg you can use of CImage class and then use of a hbitmap for set it to controls.

                doesn't you think, CImage required ample amount of code and inclusion of header file to make it work in vc++.. but i believe it is one of good class provided by MS for image handlling. i believe C# also use same interface!

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                Never mind - my own stupidity is the source of every "problem" - Mixture

                cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                H 1 Reply Last reply
                0
                • Y Y K Kishore Kumar

                  I have no idea how to load the images from a file at run time. please give some sample code. Kishore

                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #11

                  Y K Kishore Kumar wrote:

                  please give some sample code.

                  google is your friend .. dude. !

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                  Never mind - my own stupidity is the source of every "problem" - Mixture

                  cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                  1 Reply Last reply
                  0
                  • T ThatsAlok

                    Hamid. wrote:

                    if you want to load other files like jpg you can use of CImage class and then use of a hbitmap for set it to controls.

                    doesn't you think, CImage required ample amount of code and inclusion of header file to make it work in vc++.. but i believe it is one of good class provided by MS for image handlling. i believe C# also use same interface!

                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                    Never mind - my own stupidity is the source of every "problem" - Mixture

                    cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                    H Offline
                    H Offline
                    Hamid Taebi
                    wrote on last edited by
                    #12

                    Yeah CImage has a header file that it gives some memory but I guess maybe he will have problem on next for jpg files so I suggest this class however he can uses of GDI+.

                    T 1 Reply Last reply
                    0
                    • H Hamid Taebi

                      Yeah CImage has a header file that it gives some memory but I guess maybe he will have problem on next for jpg files so I suggest this class however he can uses of GDI+.

                      T Offline
                      T Offline
                      ThatsAlok
                      wrote on last edited by
                      #13

                      Hamid. wrote:

                      Yeah CImage has a header file that it gives some memory

                      did you intended to say memory leak!

                      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                      Never mind - my own stupidity is the source of every "problem" - Mixture

                      cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                      H 1 Reply Last reply
                      0
                      • T ThatsAlok

                        Hamid. wrote:

                        Yeah CImage has a header file that it gives some memory

                        did you intended to say memory leak!

                        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                        Never mind - my own stupidity is the source of every "problem" - Mixture

                        cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                        H Offline
                        H Offline
                        Hamid Taebi
                        wrote on last edited by
                        #14

                        No its not memory leak but increase Mem Usage of a program when I worked with it I dont know why?

                        T 1 Reply Last reply
                        0
                        • H Hamid Taebi

                          No its not memory leak but increase Mem Usage of a program when I worked with it I dont know why?

                          T Offline
                          T Offline
                          ThatsAlok
                          wrote on last edited by
                          #15

                          Hamid. wrote:

                          No its not memory leak but increase Mem Usage of a program when I worked with it I dont know why?

                          might be creating/putting image data in memory! thats why it's increase usage of memeory sometimes

                          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                          Never mind - my own stupidity is the source of every "problem" - Mixture

                          cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                          H 1 Reply Last reply
                          0
                          • T ThatsAlok

                            Hamid. wrote:

                            No its not memory leak but increase Mem Usage of a program when I worked with it I dont know why?

                            might be creating/putting image data in memory! thats why it's increase usage of memeory sometimes

                            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                            Never mind - my own stupidity is the source of every "problem" - Mixture

                            cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                            H Offline
                            H Offline
                            Hamid Taebi
                            wrote on last edited by
                            #16

                            I dont know I tried to find problem but I couldnt.

                            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