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. Which API can set a image file as wallpaper?

Which API can set a image file as wallpaper?

Scheduled Pinned Locked Moved C / C++ / MFC
jsonquestion
4 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.
  • W Offline
    W Offline
    white jungle
    wrote on last edited by
    #1

    I do have MSDN.But I don't know which keyword I can use to look for it!

    R K S 3 Replies Last reply
    0
    • W white jungle

      I do have MSDN.But I don't know which keyword I can use to look for it!

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      SystemParametersInfo() with the SPI_SETDESK_WALLPAPER option. However, this is a temporary change (it disappears after a reboot). To make it permanent, you'll also have to change the registry. The key to look at is "HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper". Remember that this only works if web-view is disabled for the desktop, and Windows can only show BMP images when web-view is disabled. Hope this helps Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
      Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

      1 Reply Last reply
      0
      • W white jungle

        I do have MSDN.But I don't know which keyword I can use to look for it!

        K Offline
        K Offline
        kindows
        wrote on last edited by
        #3

        Try SystemParametersInfo

        1 Reply Last reply
        0
        • W white jungle

          I do have MSDN.But I don't know which keyword I can use to look for it!

          S Offline
          S Offline
          Sardaukar
          wrote on last edited by
          #4

          [MSDN October 2001] IActiveDesktop::SetWallpaper Sets the wallpaper for the Active Desktop. HRESULT SetWallpaper( LPCWSTR pwszWallpaper, DWORD dwReserved ); Parameters pwszWallpaper String value containing the file name of the wallpaper to be set. dwReserved Reserved. Must be set to zero. Return Values Returns S_OK if successful, or an OLE error code otherwise. See Also IActiveDesktop Requirements Version 4.71 and later of Shell32.dll Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later). Windows 95/98/Me: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later). Header: Declared in Shlobj.h. So it should work from IE 4.0+. Hope it helps. For a lower version, try SystemParametersInfo: BOOL SystemParametersInfo( UINT uiAction, // system parameter to retrieve or set UINT uiParam, // depends on action to be taken PVOID pvParam, // depends on action to be taken UINT fWinIni // user profile update option ); SPI_SETDESKWALLPAPER Sets the desktop wallpaper. The value of the pvParam parameter determines the new wallpaper. To specify a wallpaper bitmap, set pvParam to point to a null-terminated string containing the name of a bitmap file. Setting pvParam to "" removes the wallpaper. Setting pvParam to SETWALLPAPER_DEFAULT or NULL reverts to the default wallpaper.

          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