 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
help101 Guest
|
Posted: Sun Mar 14, 2010 4:33 am Post subject: stop desktop background being changed? |
|
|
Hi,
I'm trying to make a script which stops the desktop background being changed, or reverts it immediately when it does.
Any ideas?
Thanks! |
|
| Back to top |
|
 |
None
Joined: 28 Nov 2009 Posts: 3086
|
Posted: Sun Mar 14, 2010 5:51 am Post subject: |
|
|
| Quote: | ; Example: Changes the desktop wallpaper to the specified bitmap (.bmp) file.
DllCall("SystemParametersInfo", UInt, 0x14, UInt, 0, Str, A_WinDir . "\winnt.bmp", UInt, 2) |
Googled SystemParametersInfo and found | Quote: | | SPI_GETDESKWALLPAPER Retrieves the full path of the bitmap file for the desktop wallpaper. The pvParam parameter must point to a buffer to receive the NULL-terminated path string. Set the uiParam parameter to the size, in characters, of the pvParam buffer. The returned string will not exceed MAX_PATH characters. If there is no desktop wallpaper, the returned string is empty. |
But I don't know how to make this into a Dll Call that checkes what the current desktop is  |
|
| Back to top |
|
 |
None
Joined: 28 Nov 2009 Posts: 3086
|
Posted: Sun Mar 14, 2010 8:12 am Post subject: |
|
|
Found a Reg Key
| Code: | RegRead, Var, HKEY_CURRENT_USER, Control Panel\Desktop , Wallpaper
MsgBox % Var |
You could Make a Loop with this checking the current Wallpaper and the Above DllCall Changing it back if Changed
Proably should do a RegWrite also because the DllCall Does not change the Key's value
Decided to try it (Tested on XP)
| Code: | DeskTopFile:=A_WinDir . "\zapotec.bmp"
Loop
{
RegRead, Var, HKEY_CURRENT_USER, Control Panel\Desktop , Wallpaper
If (Var<>DeskTopFile)
{
DllCall("SystemParametersInfo", UInt, 0x14, UInt, 0, Str, DeskTopFile, UInt, 2)
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop , Wallpaper, %DeskTopFile%
}
Sleep 2000
} |
Edit: Added Code |
|
| Back to top |
|
 |
closed
Joined: 07 Feb 2008 Posts: 509
|
Posted: Sun Mar 14, 2010 8:16 pm Post subject: |
|
|
you can set a policy by creating the reg entries:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\policies\ActiveDesktop]
"NoChangingWallPaper"=dword:00000001 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|