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. Desktop wallpaper/background

Desktop wallpaper/background

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
3 Posts 2 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.
  • D Offline
    D Offline
    daavena
    wrote on last edited by
    #1

    Hi gentlemen, is there an option how to obtain desktop wallpaper/background. I need to use it in the BitBlt function. I need to copy part of Desktop wallpaper/background to my appl. I've tried: hDesktopWindow = GetDesktopWindow(); HDC hdc = GetDC(hDesktopWindow) or HDC hdc = GetDC(NULL) and than I used hdc in the BitBlt function as source hdc - but It doesn't work because I got desktop with all opened windows - I need only wallpaer without windows. I've also tried PaintDesktop() function. It gets me the same result - results desktop with all windows. or HDC hdc = GetDC(GetDesktopWindow()) int iResult = GetObject(hdc,sizeof(HBITMAP), &hBitmap) iResult is allways 0 and GetLastError gets 6 = ERROR_INVALID_HANDLE Any idea? Thanks.

    _ 1 Reply Last reply
    0
    • D daavena

      Hi gentlemen, is there an option how to obtain desktop wallpaper/background. I need to use it in the BitBlt function. I need to copy part of Desktop wallpaper/background to my appl. I've tried: hDesktopWindow = GetDesktopWindow(); HDC hdc = GetDC(hDesktopWindow) or HDC hdc = GetDC(NULL) and than I used hdc in the BitBlt function as source hdc - but It doesn't work because I got desktop with all opened windows - I need only wallpaer without windows. I've also tried PaintDesktop() function. It gets me the same result - results desktop with all windows. or HDC hdc = GetDC(GetDesktopWindow()) int iResult = GetObject(hdc,sizeof(HBITMAP), &hBitmap) iResult is allways 0 and GetLastError gets 6 = ERROR_INVALID_HANDLE Any idea? Thanks.

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      daavena wrote:

      HDC hdc = GetDC(GetDesktopWindow())

      Try HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) instead. This will simply capture the existing screen on all monitors. If you want to get the desktop wallpaper you should use SystemParametersInfo(SPI_GETDESKWALLPAPER, ... Look at the documentation of SystemParametersInfo Function[^]

      «_Superman_» I love work. It gives me something to do between weekends.

      D 1 Reply Last reply
      0
      • _ _Superman_

        daavena wrote:

        HDC hdc = GetDC(GetDesktopWindow())

        Try HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) instead. This will simply capture the existing screen on all monitors. If you want to get the desktop wallpaper you should use SystemParametersInfo(SPI_GETDESKWALLPAPER, ... Look at the documentation of SystemParametersInfo Function[^]

        «_Superman_» I love work. It gives me something to do between weekends.

        D Offline
        D Offline
        daavena
        wrote on last edited by
        #3

        Hi, thanks for your reply, Try HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) instead but as you said this capture whole screen with all windows - I do not need this. What I need is screen backgroud without any windows. Because I need copy a part of screen backgroud to my window. I know SystemParametersInfo function. It gives me the name of wallpaper only.

        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