IDesktopWallpaper::GetWallpaper method (shobjidl_core.h)

Gets the current desktop wallpaper.


HRESULT GetWallpaper(
  [in]  LPCWSTR monitorID,
  [out] LPWSTR  *wallpaper


[in] monitorID

The ID of the monitor. This value can be obtained through GetMonitorDevicePathAt.

This value can be set to NULL. In that case, if a single wallpaper image is displayed on all of the system's monitors, the method returns successfully. If this value is set to NULL and different monitors are displaying different wallpapers or a slideshow is running, the method returns S_FALSE and an empty string in the wallpaper parameter.

[out] wallpaper

The address of a pointer to a buffer that, when this method returns successfully, receives the path to the wallpaper image file. Note that this image could be currently displayed on all of the system's monitors, not just the monitor specified in the monitorID parameter.

This string will be empty if no wallpaper image is being displayed or if a monitor is displaying a solid color. The string will also be empty if the method fails.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)

See also