Jump to content

Need a script to change wallpaper to None


Recommended Posts


You could set it in the registry (set HKCU\Control Panel\Desktop\Wallpaper to nothing or just delete the key). But making it "refresh" without logging off and on won't be so simple (the old rundll trick isn't working anymore, and restarting explorer.exe is pretty extreme), so you'd basically have to write a small program which would make the Win32 API call for that (it might as well "fix" the registry too...).

Link to comment
Share on other sites

so you'd basically have to write a small program which would make the Win32 API call for that (it might as well "fix" the registry too...).

You mean like this one? (I had it sitting around from when another person asked this question) Please let me know if there are any issues or if it helps out with your problem, OP.

Link to comment
Share on other sites

You mean like this one?

Kind of over-delivering ;) I was thinking of a simple/blind "nuke the wallpaper" option ala (code not actually tested)


SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "", SPIF_SENDWININICHANGE);

or even


push SPIF_SENDWININICHANGE ;2
push 0 ;(pointer to zero length string, but zero works too)
push 0
push SPI_SETDESKWALLPAPER ;0x14
call SystemParametersInfoA

but this can accomplish this (albeit you have to pass cmd line args for that) and a bunch more (setting wallpaper with options, setting more registry entries)

Although this only solves part of the problem. Users can still set wallpapers by hand after that (even though not so convenient). Many small programs who cycle wallpapers will happily override this every few minutes, like webshots desktop, or Win7's desktop slideshow. A complete solution would check for Win 7 and disable desktop slideshow, likely change some settings using group policy, and you could even change the permissions on those registry keys... A "proper fix" would require some thought and some testing too.

Link to comment
Share on other sites

Kind of over-delivering ;) I was thinking of a simple/blind "nuke the wallpaper" option ala (code not actually tested)

Actually it worked for the previous person, who wanted to set a specific bitmap upon login and have it show immediately. But why not support what you can when you do it, especially since the source for the program isn't that long? The same mechanics for that will work here if all the OP wants is the bitmap to be gone immediately. You suggested the program, I already had it on hand, so I posted it. That said...

Although this only solves part of the problem. A "proper fix" would require some thought and some testing too.

It's hard to tell exactly what someone is looking to accomplish - it seems we are assuming what the OP wants by filling in the blanks on what is otherwise unsaid. Disabling the changing of the background wallpaper is another thing entirely, but as I understood it, the program previously generated will work here if the desire is to have the change reflected immediately. Otherwise, I'd just suggest the registry changes via script.

Link to comment
Share on other sites

how do I put this in a batch file?, is this a vbs, or cmd sorry for my ignorance here.

You mean like this one?

Kind of over-delivering ;) I was thinking of a simple/blind "nuke the wallpaper" option ala (code not actually tested)


SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "", SPIF_SENDWININICHANGE);

or even


push SPIF_SENDWININICHANGE ;2
push 0 ;(pointer to zero length string, but zero works too)
push 0
push SPI_SETDESKWALLPAPER ;0x14
call SystemParametersInfoA

but this can accomplish this (albeit you have to pass cmd line args for that) and a bunch more (setting wallpaper with options, setting more registry entries)

Although this only solves part of the problem. Users can still set wallpapers by hand after that (even though not so convenient). Many small programs who cycle wallpapers will happily override this every few minutes, like webshots desktop, or Win7's desktop slideshow. A complete solution would check for Win 7 and disable desktop slideshow, likely change some settings using group policy, and you could even change the permissions on those registry keys... A "proper fix" would require some thought and some testing too.

Link to comment
Share on other sites

how do I put this in a batch file?, is this a vbs, or cmd sorry for my ignorance here.

As per the documentation and files included, it's a program. For what you indicate, you just put in your batch, cmd, or vbs (whatever works to run something) the following command line.


wpchange none 0

If you run that, it should eliminate the background bitmap

Link to comment
Share on other sites

You suggested the program, I already had it on hand, so I posted it.

I didn't mean it was a bad thing that it had more features (that's usually a good thing), but merely that I had something simpler (trivial) in mind.

It's hard to tell exactly what someone is looking to accomplish - it seems we are assuming what the OP wants by filling in the blanks on what is otherwise unsaid. Disabling the changing of the background wallpaper is another thing entirely, but as I understood it, the program previously generated will work here if the desire is to have the change reflected immediately.

And this is where I more or less guess different (we are basically guessing indeed). Lots of work places don't allow wallpapers and want to enforce that. This removes the current wallpaper once run, but users can still set one up again using the usual ways, and many programs (windows' desktop slideshow, the popular webshots desktop, etc) will add one over and over again. So if it's like one of those workplaces (which may or may not be the case) then there is more to it, and it will require some thinking to come up with a proper solution instead of a band aid fix. It's hard to just guess the big picture accurately i.e. what he's trying to accomplish "overall" -- and I don't think the need is "just remove the wallpapers once and let people add one again later".

how do I put this in a batch file?, is this a vbs, or cmd

That was neither (C++ and assembly, which would need to be compiled first before they can be used). The end result would be the same as Glen9999's tool when used with "none 0". Again, this removes the current wallpaper when run, but you have to be aware of the "limitations".

Link to comment
Share on other sites

I didn't mean it was a bad thing that it had more features (that's usually a good thing), but merely that I had something simpler (trivial) in mind.

No offense taken.

Lots of work places don't allow wallpapers and want to enforce that. ...

So if it's like one of those workplaces (which may or may not be the case) then there is more to it, and it will require some thinking to come up with a proper solution instead of a band aid fix.

Definitely understood. The poster before this one that I referred to wanted to ensure a bitmap with the company logo showed up upon login of everyone and wanted to do it on the standard user login script. As I remember, the question of locking down the settings to change it came up then. As I recall, there are some group policy things that can be set to eliminate the user changing it, like through Desktop Settings. But the problem as was expressed with that was that other programs can effectively "get around" any of these restrictions, if present (basically anything with a "Set as Background" option, even MS Paint). Evidently, the API call is not checked for security settings, and the registry can't be locked down because there are usually legitimate programs that need access to it. No one really presented a good solution then where the desktop wallpaper stayed permanently in all cases.

(this was back when most companies had XP/2000 deployed and Vista was kind of new, so I don't know if you could actually lock down the desktop background tight on those)

Edited by Glenn9999
Link to comment
Share on other sites

the registry can't be locked down because there are usually legitimate programs that need access to it

That's ultimately what needs to be protected against writes (API calls and various apps *should* fail then). I don't see what would make it problematic but I haven't given that much thought, and there just may be some issues. Setting complex ACLs on registry entries can be kind of a pain though, and either ways it would require some testing on his end too (at a prior employer we used to have a "guinea pig" group precisely for this kind of stuff).

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 years later...

Hi,

Do you know if the wpchange is available in X64 version?

Regards

 

I happened to pull this out today to look at it, and it worked on my Windows 8.1 x64.  Is there any particular reason why it wouldn't work on any other x64 version?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...