3

I want to make some changes on active desktop wallpaper like adding watermark.

For that I need to get the path of active wallpaper path. adding watermark I can do.

This can be done using JNA library, but i can't able to access the file path.

Josh Crozier
  • 219,308
  • 53
  • 366
  • 287
pankaj_ar
  • 727
  • 2
  • 10
  • 31
  • Can you access under its registry `HKEY_CURRENT_USER\Control Panel\Desktop\ `: `Wallpaper`, `OriginalWallpaper` or `ConvertedWallpaper` entry? [See link](http://hdsurvivor.blogspot.com/2006/05/set-default-wallpaper-for-users-in.html) – ee. Dec 05 '11 at 07:23

2 Answers2

3

The way to obtain the current desktop wallpaper could different based on the operating system, for windows 7 it can be obtained from following registry path,

HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper

to read the registry path you can use the method described in following question

read/write to Windows Registry using Java

Community
  • 1
  • 1
Low Flying Pelican
  • 5,934
  • 1
  • 28
  • 42
  • That was already mentioned on the comment above (except you added the SO link on how to read/write to Windows Registry). – Buhake Sindi Dec 05 '11 at 08:53
2

As Low Flying Pelican and ee said,

HKEY_CURRENT_USER\Control Panel\Desktop

contains the key Wallpaper which has a pointer to the wallpaper. For the command prompt, you can use

reg query "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper

to get the location, or using this for native java support:

Runtime.getRuntime().exec('reg query "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper');
Community
  • 1
  • 1
LemonJuiz
  • 21
  • 3