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 a memory DC to a file

Saving a memory DC to a file

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsperformancequestion
6 Posts 4 Posters 2 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    When doing drawing first you do it to memory than BitBlt to the device -> device context can to you save the memory dc to a file ? thanks

    Mircea NeacsuM L 2 Replies Last reply
    0
    • F ForNow

      When doing drawing first you do it to memory than BitBlt to the device -> device context can to you save the memory dc to a file ? thanks

      Mircea NeacsuM Offline
      Mircea NeacsuM Offline
      Mircea Neacsu
      wrote on last edited by
      #2

      Sure. See this sample: Capturing an Image - Win32 apps | Microsoft Docs[^]

      Mircea

      F 1 Reply Last reply
      0
      • F ForNow

        When doing drawing first you do it to memory than BitBlt to the device -> device context can to you save the memory dc to a file ? thanks

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

        No, as shown in the documentation at GetDC function (winuser.h) - Win32 apps | Microsoft Docs[^]:

        Quote:

        The GetDC function retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC. The device context is an opaque data structure, whose values are used internally by GDI.

        You need to save other information that you use to create the drawing.

        F 1 Reply Last reply
        0
        • Mircea NeacsuM Mircea Neacsu

          Sure. See this sample: Capturing an Image - Win32 apps | Microsoft Docs[^]

          Mircea

          F Offline
          F Offline
          ForNow
          wrote on last edited by
          #4

          I am writing a pie chart using pie and ellipse first doing CreateCompatableBitmap Selecting to mem dc but the example will work thanks

          1 Reply Last reply
          0
          • L Lost User

            No, as shown in the documentation at GetDC function (winuser.h) - Win32 apps | Microsoft Docs[^]:

            Quote:

            The GetDC function retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC. The device context is an opaque data structure, whose values are used internally by GDI.

            You need to save other information that you use to create the drawing.

            F Offline
            F Offline
            ForNow
            wrote on last edited by
            #5

            I am writing a pie chart using pie and ellipse first doing CreateCompatableBitmap Selecting to mem dc but the example will work

            Mircea provided an example that will work for me thanks

            V 1 Reply Last reply
            0
            • F ForNow

              I am writing a pie chart using pie and ellipse first doing CreateCompatableBitmap Selecting to mem dc but the example will work

              Mircea provided an example that will work for me thanks

              V Offline
              V Offline
              Victor Nijegorodov
              wrote on last edited by
              #6

              ForNow wrote:

              Mircea provided an example that will work for me

              Yes. However in this example the bitmap is saved into the file, and not the memory or some other DC (device context)!

              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