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. Please help with Screen Capture Wallpaper with PaintDesktop(HDC hdc) API

Please help with Screen Capture Wallpaper with PaintDesktop(HDC hdc) API

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphicsregexjsonperformance
3 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.
  • J Offline
    J Offline
    JavaTony
    wrote on last edited by
    #1

    Hello all, I am trying to capture desktop wallpaper into memory device context, but it wasn't successful. Here are the steps I did. 1: create a DC for the screen and create a compatible memory DC to screen DC 2: get screen resolution for bitmap width and height 3: create a bitmap compatible with the screen DC with width and height obtained from step 2 4: select created bitmap into memory DC as a drawing surface 5: create clipping region in the memory DC 6: paint the desktop pattern to the memory DC with PaintDesktop(HDC hdc) API function 7: copy the bitmap in the memory DC on to the clipboard, I got a black image when pasting it to WordPad. Could you please give me some pointers for this problem? Did you spot any problems in the steps I performed? I can tell that PaintDesktop() didn't paint the desktop pattern into my memory DC. I really got stuck. Thank you very much for your help. :) :) ;) :) :) :) :)

    C T 2 Replies Last reply
    0
    • J JavaTony

      Hello all, I am trying to capture desktop wallpaper into memory device context, but it wasn't successful. Here are the steps I did. 1: create a DC for the screen and create a compatible memory DC to screen DC 2: get screen resolution for bitmap width and height 3: create a bitmap compatible with the screen DC with width and height obtained from step 2 4: select created bitmap into memory DC as a drawing surface 5: create clipping region in the memory DC 6: paint the desktop pattern to the memory DC with PaintDesktop(HDC hdc) API function 7: copy the bitmap in the memory DC on to the clipboard, I got a black image when pasting it to WordPad. Could you please give me some pointers for this problem? Did you spot any problems in the steps I performed? I can tell that PaintDesktop() didn't paint the desktop pattern into my memory DC. I really got stuck. Thank you very much for your help. :) :) ;) :) :) :) :)

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

      HKEY_CURRENT_USER\Desktop\Wallpaper will give you the path to the wallpaper file, then it would be easy to use ::LoadImage ( assuming a bmp ) to load it into a DC and copy it across to another if desired. Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.

      1 Reply Last reply
      0
      • J JavaTony

        Hello all, I am trying to capture desktop wallpaper into memory device context, but it wasn't successful. Here are the steps I did. 1: create a DC for the screen and create a compatible memory DC to screen DC 2: get screen resolution for bitmap width and height 3: create a bitmap compatible with the screen DC with width and height obtained from step 2 4: select created bitmap into memory DC as a drawing surface 5: create clipping region in the memory DC 6: paint the desktop pattern to the memory DC with PaintDesktop(HDC hdc) API function 7: copy the bitmap in the memory DC on to the clipboard, I got a black image when pasting it to WordPad. Could you please give me some pointers for this problem? Did you spot any problems in the steps I performed? I can tell that PaintDesktop() didn't paint the desktop pattern into my memory DC. I really got stuck. Thank you very much for your help. :) :) ;) :) :) :) :)

        T Offline
        T Offline
        Tomasz Sowinski
        wrote on last edited by
        #3

        PaintDesktop worked OK with memory device context in NT 4. In Windows 2000 it fails. The funny thing is that you can call PaintDesktop with HDC obtained using ::GetDC or CClientDC and it will work, even on Win2000. Tomasz Sowinski -- http://www.shooltz.com.pl

        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