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. image capture

image capture

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelpquestion
5 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.
  • I Offline
    I Offline
    indrajeshr
    wrote on last edited by
    #1

    Hi Can anyone help me capturing a part of the window as a bitmap? Currently, the code i wrote captures the top-lying windows as well. I dont want it to capture them. HGDIOBJ prev = SelectObject(memdc, mybitmap); //Drawing functions. BitBlt( memdc, 0, 0, w, h, sourcedc, SRCCOPY); SelectObject(memdc, prev); Thanks

    cheers rajesh.r

    R G 2 Replies Last reply
    0
    • I indrajeshr

      Hi Can anyone help me capturing a part of the window as a bitmap? Currently, the code i wrote captures the top-lying windows as well. I dont want it to capture them. HGDIOBJ prev = SelectObject(memdc, mybitmap); //Drawing functions. BitBlt( memdc, 0, 0, w, h, sourcedc, SRCCOPY); SelectObject(memdc, prev); Thanks

      cheers rajesh.r

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      With GDI, I am honestly not sure you can blit a window if it is hidden behind others (since you do not blit a window but a device). What you can do (if this is not unituitive for the user) is bring the window as topmost, and blit it.

      ~RaGE();

      I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
      Do not feed the troll ! - Common proverb

      1 Reply Last reply
      0
      • I indrajeshr

        Hi Can anyone help me capturing a part of the window as a bitmap? Currently, the code i wrote captures the top-lying windows as well. I dont want it to capture them. HGDIOBJ prev = SelectObject(memdc, mybitmap); //Drawing functions. BitBlt( memdc, 0, 0, w, h, sourcedc, SRCCOPY); SelectObject(memdc, prev); Thanks

        cheers rajesh.r

        G Offline
        G Offline
        Greg Daye
        wrote on last edited by
        #3

        If you get the device context of an underlying window, shouldn't it output the display of that window? i.e. if you have the handle to the window you want to bitblt, you should be able to do a GetDC() on that window, then blit from that dc... It should blit what is being displayed on that window, regardless of a window is over top of it. I think. Where are you getting the sourcedc in the example?

        M 1 Reply Last reply
        0
        • G Greg Daye

          If you get the device context of an underlying window, shouldn't it output the display of that window? i.e. if you have the handle to the window you want to bitblt, you should be able to do a GetDC() on that window, then blit from that dc... It should blit what is being displayed on that window, regardless of a window is over top of it. I think. Where are you getting the sourcedc in the example?

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Greg Daye wrote:

          It should blit what is being displayed on that window, regardless of a window is over top of it.

          Not so. Once it's on the screen it's on the screen. Device contexts obtained for windows represent the device the window is rendered on (the screen).

          I 1 Reply Last reply
          0
          • M Mark Salsbery

            Greg Daye wrote:

            It should blit what is being displayed on that window, regardless of a window is over top of it.

            Not so. Once it's on the screen it's on the screen. Device contexts obtained for windows represent the device the window is rendered on (the screen).

            I Offline
            I Offline
            indrajeshr
            wrote on last edited by
            #5

            Yeah. Greg is right. Blitting somehow doesn't restrict itself to the lower level window dc. It takes information from the top level window as well. What I felt was, to somehow update the memory dc after the draw operation. I tried sending WM_PRINT message, which I found in msdn said, it updates the dc. This too doesn't help me. Anymore insights or workarounds to do the job? Thanks

            cheers rajesh.r

            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