Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

Need a script to change wallpaper to None

- - - - -

  • Please log in to reply
12 replies to this topic

#1
clivebuckwheat

clivebuckwheat

    Senior Member

  • Member
  • PipPipPipPip
  • 574 posts
  • Joined 07-November 05
is there a way to change the wall paper settings to none via command line or script?


How to remove advertisement from MSFN

#2
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 4,973 posts
  • Joined 14-July 04
  • OS:Windows 7 x64
  • Country: Country Flag
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...).
Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#3
Glenn9999

Glenn9999

    Senior Member

  • Member
  • PipPipPipPip
  • 678 posts
  • Joined 23-April 07
  • OS:Windows 8.1 x64
  • Country: Country Flag

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.

#4
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 4,973 posts
  • Joined 14-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

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.
Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#5
Glenn9999

Glenn9999

    Senior Member

  • Member
  • PipPipPipPip
  • 678 posts
  • Joined 23-April 07
  • OS:Windows 8.1 x64
  • Country: Country Flag

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.

#6
clivebuckwheat

clivebuckwheat

    Senior Member

  • Member
  • PipPipPipPip
  • 574 posts
  • Joined 07-November 05
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.



#7
Glenn9999

Glenn9999

    Senior Member

  • Member
  • PipPipPipPip
  • 678 posts
  • Joined 23-April 07
  • OS:Windows 8.1 x64
  • Country: Country Flag

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

#8
clivebuckwheat

clivebuckwheat

    Senior Member

  • Member
  • PipPipPipPip
  • 574 posts
  • Joined 07-November 05
thanks to everyone for your help it really worked out nicely.

#9
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 4,973 posts
  • Joined 14-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

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".
Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#10
Glenn9999

Glenn9999

    Senior Member

  • Member
  • PipPipPipPip
  • 678 posts
  • Joined 23-April 07
  • OS:Windows 8.1 x64
  • Country: Country Flag

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, 03 February 2011 - 12:25 AM.


#11
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 4,973 posts
  • Joined 14-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

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).
Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#12
bjorne78

bjorne78

    Newbie

  • Member
  • 29 posts
  • Joined 26-January 07
Hi,

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


Regards

#13
Glenn9999

Glenn9999

    Senior Member

  • Member
  • PipPipPipPip
  • 678 posts
  • Joined 23-April 07
  • OS:Windows 8.1 x64
  • Country: Country Flag

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?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users