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 capture a big window?

how to capture a big window?

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelptutorialquestion
5 Posts 3 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.
  • R Offline
    R Offline
    Rockone
    wrote on last edited by
    #1

    i want to capture a window to a bitmap. when the document size is bigger than current viewable rectangle, if using the document size to the captured image will has a big black block. CSize size = GetTotalSize(); CClientDC dc(this); CDC memDc; if(!memDc.CreateCompatibleDC(&dc)) { return ; } CBitmap bitmap; if( !bitmap.CreateCompatibleBitmap(&dc, size.cx, size.cy) ) { return ; } CBitmap* pOldBitmap = memDc.SelectObject(&bitmap); memDc.BitBlt(0, 0, size.cx, size.cy, &dc, 0, 0, SRCCOPY ); if( OpenClipboard() ) { EmptyClipboard(); SetClipboardData(CF_BITMAP, bitmap.GetSafeHandle()); CloseClipboard(); } memDc.SelectObject(pOldBitmap); any suggestion or tips will be great help. thank you in advance.

    C 1 Reply Last reply
    0
    • R Rockone

      i want to capture a window to a bitmap. when the document size is bigger than current viewable rectangle, if using the document size to the captured image will has a big black block. CSize size = GetTotalSize(); CClientDC dc(this); CDC memDc; if(!memDc.CreateCompatibleDC(&dc)) { return ; } CBitmap bitmap; if( !bitmap.CreateCompatibleBitmap(&dc, size.cx, size.cy) ) { return ; } CBitmap* pOldBitmap = memDc.SelectObject(&bitmap); memDc.BitBlt(0, 0, size.cx, size.cy, &dc, 0, 0, SRCCOPY ); if( OpenClipboard() ) { EmptyClipboard(); SetClipboardData(CF_BITMAP, bitmap.GetSafeHandle()); CloseClipboard(); } memDc.SelectObject(pOldBitmap); any suggestion or tips will be great help. thank you in advance.

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

      A window only renders if it's on the visible area. Grabbing outside your desktop just isn't going to do anything.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      S R 2 Replies Last reply
      0
      • C Christian Graus

        A window only renders if it's on the visible area. Grabbing outside your desktop just isn't going to do anything.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        You can use the PrintWindow function to do this I believe.

        Steve

        R 1 Reply Last reply
        0
        • S Stephen Hewitt

          You can use the PrintWindow function to do this I believe.

          Steve

          R Offline
          R Offline
          Rockone
          wrote on last edited by
          #4

          thank you, i will give it a try.

          1 Reply Last reply
          0
          • C Christian Graus

            A window only renders if it's on the visible area. Grabbing outside your desktop just isn't going to do anything.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

            R Offline
            R Offline
            Rockone
            wrote on last edited by
            #5

            thank you! i know that, but i have to get the big one.

            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