AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

stop desktop background being changed?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
help101
Guest





PostPosted: Sun Mar 14, 2010 4:33 am    Post subject: stop desktop background being changed? Reply with quote

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

PostPosted: Sun Mar 14, 2010 5:51 am    Post subject: Reply with quote

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 Sad
Back to top
View user's profile Send private message
None



Joined: 28 Nov 2009
Posts: 3086

PostPosted: Sun Mar 14, 2010 8:12 am    Post subject: Reply with quote

Found a Reg Key Smile
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 Sad

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
View user's profile Send private message
closed



Joined: 07 Feb 2008
Posts: 509

PostPosted: Sun Mar 14, 2010 8:16 pm    Post subject: Reply with quote

you can set a policy by creating the reg entries:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\policies\ActiveDesktop]
"NoChangingWallPaper"=dword:00000001
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group