MSFN Forum: Need a script to change wallpaper to None - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Need a script to change wallpaper to None Rate Topic: -----

#1 User is offline   clivebuckwheat 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 538
  • Joined: 07-November 05

Posted 31 January 2011 - 10:19 PM

is there a way to change the wall paper settings to none via command line or script?


#2 User is offline   CoffeeFiend 

  • Coffee Aficionado
  • Group: Super Moderator
  • Posts: 5,260
  • Joined: 14-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 31 January 2011 - 11:47 PM

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...).

#3 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 595
  • Joined: 23-April 07

Posted 01 February 2011 - 01:40 AM

View PostCoffeeFiend, on 31 January 2011 - 11:47 PM, said:

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 User is offline   CoffeeFiend 

  • Coffee Aficionado
  • Group: Super Moderator
  • Posts: 5,260
  • Joined: 14-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 01 February 2011 - 02:47 AM

View PostGlenn9999, on 01 February 2011 - 01:40 AM, said:

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.

#5 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 595
  • Joined: 23-April 07

Posted 01 February 2011 - 03:21 AM

View PostCoffeeFiend, on 01 February 2011 - 02:47 AM, said:

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...

Quote

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 User is offline   clivebuckwheat 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 538
  • Joined: 07-November 05

Posted 01 February 2011 - 09:14 AM

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

View PostCoffeeFiend, on 01 February 2011 - 02:47 AM, said:

View PostGlenn9999, on 01 February 2011 - 01:40 AM, said:

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 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 595
  • Joined: 23-April 07

Posted 01 February 2011 - 04:35 PM

View Postclivebuckwheat, on 01 February 2011 - 09:14 AM, said:

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 User is offline   clivebuckwheat 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 538
  • Joined: 07-November 05

Posted 01 February 2011 - 11:49 PM

thanks to everyone for your help it really worked out nicely.

#9 User is offline   CoffeeFiend 

  • Coffee Aficionado
  • Group: Super Moderator
  • Posts: 5,260
  • Joined: 14-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 02 February 2011 - 04:57 PM

View PostGlenn9999, on 01 February 2011 - 03:21 AM, said:

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.

View PostGlenn9999, on 01 February 2011 - 03:21 AM, said:

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".

View Postclivebuckwheat, on 01 February 2011 - 09:14 AM, said:

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".

#10 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 595
  • Joined: 23-April 07

Posted 03 February 2011 - 12:24 AM

View PostCoffeeFiend, on 02 February 2011 - 04:57 PM, said:

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.

View PostCoffeeFiend, on 02 February 2011 - 04:57 PM, said:

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)

This post has been edited by Glenn9999: 03 February 2011 - 12:25 AM


#11 User is offline   CoffeeFiend 

  • Coffee Aficionado
  • Group: Super Moderator
  • Posts: 5,260
  • Joined: 14-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 03 February 2011 - 01:11 AM

View PostGlenn9999, on 03 February 2011 - 12:24 AM, said:

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).

#12 User is offline   bjorne78 

  • Newbie
  • Group: Members
  • Posts: 28
  • Joined: 26-January 07

Posted 12 February 2011 - 10:30 PM

Hi,

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


Regards

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy