Advertisement

[java] How to set desktop wallpaper

Started by November 18, 2000 12:20 PM
5 comments, last by Felix02 24 years, 1 month ago
I''ve searched for some java code that is capable of resetting the desktop''s wallpaper, but I haven''t been able to find any that works. Can anyone help? THanks in advance.
why would you ever want to do that? Do you know how angry you might make some people who run your program?
Advertisement
Its not for the public, but rather myself, and possibly an applet version for anyone who cares- forewarned of course.
oh ok. No I don''t know how to do it. You probably can''t just use java to do that, since java is sort of a lowest common denomimator thing, it has to work on all platforms.
Yup,

You cannot do this in Java, as it requires win32 calls.

You can do it via JNI, though. I must admit, though, that I don''t know the exact calls to use. But it can be done.

Jacob Marner

Jacob Marner, M.Sc.Console Programmer, Deadline Games
Yes, it can be done. I''ve played with this idea before and it could be applied to java as well. All you need to do it..

1) It must be running as an application! This can NOT be done from an applet.

2) You need a Image -> BMP converter

3) Basic understanding of regedit files.

Ok to make life easier if you settle on one filename for you wallpaper it will make it easier. Set it up the way you want and export ( in regedit )

HKEY_LOCAL_USER/Control Panel/Desktop

Delete all unnecessary config lines from the file and save this as restoreWall.reg or something to that extent. Now whenever you want to restore your wallpaper or install a new one, just drop your .bmp over the old one and call "regedit -q restoreWall.reg".

Unfortunatly you will need to restart to make this work. You may be able to do something cleaner with the M$ java com interface but I''m not the one to ask.
Advertisement
Make JNI function that calls SystemParametersInfo.
with the uiAction parameter set to SPI_SETDESKWALLPAPER.

This topic is closed to new replies.

Advertisement