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. Saving CDC to Bmp File

Saving CDC to Bmp File

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestion
10 Posts 4 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
    Abhishek Narula
    wrote on last edited by
    #1

    I have drawn some lines etc. on a CDC , now can I save this drawing to a Bmp File ?? How ? Thanks in advance ! Abhishek Narula "Learn to appreciate others ... World would appreciate you"

    R C 2 Replies Last reply
    0
    • A Abhishek Narula

      I have drawn some lines etc. on a CDC , now can I save this drawing to a Bmp File ?? How ? Thanks in advance ! Abhishek Narula "Learn to appreciate others ... World would appreciate you"

      R Offline
      R Offline
      Rickard Andersson20
      wrote on last edited by
      #2

      Do you want to save a file (.bmp)? If so, this question is very very very often shown here on the message board! Try CXImage in the Bitmaps & Palettes section here on CodeProject! ------------------------------ ©0d3 ©®4©k3® - That's me! :) ------------------------------

      1 Reply Last reply
      0
      • A Abhishek Narula

        I have drawn some lines etc. on a CDC , now can I save this drawing to a Bmp File ?? How ? Thanks in advance ! Abhishek Narula "Learn to appreciate others ... World would appreciate you"

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        You've actually drawn lines on a bitmap *selected* into a CDC, and has been pointed out, this question is addressed in the FAQ. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

        Sonork ID 100.10002:MeanManOz

        I live in Bob's HungOut now

        A 1 Reply Last reply
        0
        • C Christian Graus

          You've actually drawn lines on a bitmap *selected* into a CDC, and has been pointed out, this question is addressed in the FAQ. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

          Sonork ID 100.10002:MeanManOz

          I live in Bob's HungOut now

          A Offline
          A Offline
          Abhishek Narula
          wrote on last edited by
          #4

          Okay so you mean by GetCurrentBitmap() I ll get the bitmap of what ever is drawn on the screen ... so now how do i save this to a file ?? If you dont mind please give me the URL of FAQ , I am some what new to this Forum ! Regards, Abhishek Narula "Learn to appreciate others ... World would appreciate you"

          N C 2 Replies Last reply
          0
          • A Abhishek Narula

            Okay so you mean by GetCurrentBitmap() I ll get the bitmap of what ever is drawn on the screen ... so now how do i save this to a file ?? If you dont mind please give me the URL of FAQ , I am some what new to this Forum ! Regards, Abhishek Narula "Learn to appreciate others ... World would appreciate you"

            N Offline
            N Offline
            Nish Nishant
            wrote on last edited by
            #5

            Here it is :- The Mike and Maunder FAQ http://www.codeproject.com/useritems/cppforumfaq.asp Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

            A 1 Reply Last reply
            0
            • A Abhishek Narula

              Okay so you mean by GetCurrentBitmap() I ll get the bitmap of what ever is drawn on the screen ... so now how do i save this to a file ?? If you dont mind please give me the URL of FAQ , I am some what new to this Forum ! Regards, Abhishek Narula "Learn to appreciate others ... World would appreciate you"

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Abhishek Narula wrote: I am some what new to this Forum In that case, welcome. :-) As you've drawn onto this bitmap yourself, I presume you created the CDC, and selected the bitmap into it. So where is the confusion in getting hold of the bitmap, if you created it ? If you're talking about a screen DC, which MFC passed to you with a bitmap in it, you can use GetCurrentBitmap, or create a new CDC select a new bitmap into it and copy across. As for the URL, cast your eyes upward from my post and just under the banner ad for Visual Assist ( try it if you haven't got it, it rules ), is a row of links. The left most link is to the FAQ. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

              Sonork ID 100.10002:MeanManOz

              I live in Bob's HungOut now

              A 1 Reply Last reply
              0
              • C Christian Graus

                Abhishek Narula wrote: I am some what new to this Forum In that case, welcome. :-) As you've drawn onto this bitmap yourself, I presume you created the CDC, and selected the bitmap into it. So where is the confusion in getting hold of the bitmap, if you created it ? If you're talking about a screen DC, which MFC passed to you with a bitmap in it, you can use GetCurrentBitmap, or create a new CDC select a new bitmap into it and copy across. As for the URL, cast your eyes upward from my post and just under the banner ad for Visual Assist ( try it if you haven't got it, it rules ), is a row of links. The left most link is to the FAQ. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

                Sonork ID 100.10002:MeanManOz

                I live in Bob's HungOut now

                A Offline
                A Offline
                Abhishek Narula
                wrote on last edited by
                #7

                I think you have understood my problem !! I have made some drawing on my CDC , using LineTo etc .. functions .. now I want to save this drwaing as Bitmap file which I can open in MS-Paint. Can I do this ?? rather I am sure we can do this .. but How ? thats the question. Any way thanks a lot for all the pains that you have taken to reply !! Abhishek Narula "Learn to appreciate others ... World would appreciate you"

                A C 2 Replies Last reply
                0
                • A Abhishek Narula

                  I think you have understood my problem !! I have made some drawing on my CDC , using LineTo etc .. functions .. now I want to save this drwaing as Bitmap file which I can open in MS-Paint. Can I do this ?? rather I am sure we can do this .. but How ? thats the question. Any way thanks a lot for all the pains that you have taken to reply !! Abhishek Narula "Learn to appreciate others ... World would appreciate you"

                  A Offline
                  A Offline
                  Abhishek Narula
                  wrote on last edited by
                  #8

                  I am sorry in the first line i meant that you have not understood my problem , a typing mistake ! Abhishek Narula "Learn to appreciate others ... World would appreciate you"

                  1 Reply Last reply
                  0
                  • N Nish Nishant

                    Here it is :- The Mike and Maunder FAQ http://www.codeproject.com/useritems/cppforumfaq.asp Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

                    A Offline
                    A Offline
                    Abhishek Narula
                    wrote on last edited by
                    #9

                    Thanks Buster !! you have always been a great help ! thanks Abhishek Narula "Learn to appreciate others ... World would appreciate you"

                    1 Reply Last reply
                    0
                    • A Abhishek Narula

                      I think you have understood my problem !! I have made some drawing on my CDC , using LineTo etc .. functions .. now I want to save this drwaing as Bitmap file which I can open in MS-Paint. Can I do this ?? rather I am sure we can do this .. but How ? thats the question. Any way thanks a lot for all the pains that you have taken to reply !! Abhishek Narula "Learn to appreciate others ... World would appreciate you"

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #10

                      Abhishek Narula wrote: I think you have understood my problem !! I think I have to, but I don't think you've understood my replies... Abhishek Narula wrote: I have made some drawing on my CDC , using LineTo etc .. functions .. now I want to save this drwaing as Bitmap file which I can open in MS-Paint. So.... if you created the CDC, and selected a bitmap into it ( and if you created a CDC and DIDN'T select a bitmap into it, then the CDC contains a 1x1x1 bitmap ), then you already have the CBitmap, if you got the CDC from OnPaint or similar ( it's the background of a dialog box, say ), then you need to either call GetCurrentBitmap or create a new CDC/CBitmap pair to copy this bitmap across. Also, if you're creating the bitmap, creating a DIBSection will allow you to save it at any bit depth, instead of just that of the screen. You can do that with Chris Maunders DIBSection class, which is on CP. Abhishek Narula wrote: Can I do this ?? rather I am sure we can do this .. but How ? thats the question. Both Nish and I have pointed you to the FAQ, he even kindly looked up the URL ( I was too lazy ). The whole point of having a FAQ would be negated if we went off and quoted it to people unwilling to read it, don't you think ? If you've read the FAQ and are still confused, please explain which bit is not making sense to you, and I'll be happy to clarify. You can also look up my GDI+ articles or the CXImage class here on CP, two solutions offered on this site ( some of the solutions in the FAQ are not on CP ). Abhishek Narula wrote: Any way thanks a lot for all the pains that you have taken to reply !! I am always glad to help. If you are stuck after reading the FAQ, don't hesitate to ask again. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

                      Sonork ID 100.10002:MeanManOz

                      I live in Bob's HungOut now

                      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