• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

desktop's wall paper - program to change it

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

How do I change my desktop's wall paper through a program (preferably in Java)?

The options I tried are:

# 1: I change registry setting with Runtime class.
Issue: The change applies only on start up.

# 2: I change the file from where windows pics up default wall paper (c:\user\<username>\appdata\roaming\microsoft\windows proto gallary - for vista).
Issue: Like former case, the change applies only on start up.

What I would like is, it should change the wall paper immediately when I execute the program.

Any suggestions will help.

Thanks.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

With 'native' java you can not do this.

But you sad, you changed registry. I think you did this while using batch-file or vbs-script.
Did you told the system to update changes?

You can do this within a Batch-File


or within a vbs ("myShell" is a "WScript.Shell")

 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I created a registry file (.reg file) and wrote a command in that to change the wall paper.
I am executing this reg file with DOS command, using Runtime class.

Runtime.getRuntime().exec("regedit /s c:/test.reg");

This works, it changes the wall paper but only when I start my PC next time.



Just to correct myself. This doesn't work even on startup.

When I change registry value manually and restart PC, it changes the wallpaper.


Did you told the system to update changes?

You can do this within a Batch-File
view plaincopy to clipboardprint?
%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters




It doesn't tell system to update the changes.
I changed registry value manually and ran this command. It didn't update wallpaper.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic