I found out today, due to my collegue, that in Windows 7 Microsoft build an easy way to change the logon screen (computer lock screen as well) wallpaper.
I build a GUI around that in AutoIt to make life easy
Edit: Edited 256 * 1024 to 250 * 1024 so that the outcome will become the intended 256Kb. Reported by ERSL
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.0.0 (beta)
Author: Triblade
Last change: 29-may-2009
Changes: Changed 256*1024 to 250*1024, cause pictures may still be too large at 256*1024. Thanks to ERSL.
Script Function:
Script to easely change Windows 7 logon wallpaper.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#RequireAdmin
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
Dim $underscore
If @OSArch = "X64" Then
$destination_path = @WindowsDir & "\Sysnative\oobe\info\backgrounds"
Else
$destination_path = @WindowsDir & "\System32\oobe\info\backgrounds"
EndIf
$file = "backgroundDefault.jpg"
$destination_file = $destination_path & "\" & $file
$gui = GUICreate("Windows 7 logonscreen wallpaper changer", 450, 130)
GUICtrlCreateGroup("Picture && path", 10, 10, 430, 50)
$picture_label = GUICtrlCreateLabel("No picture selected.", 20, 33, 300, 25, $SS_LEFTNOWORDWRAP)
$select_picture = GUICtrlCreateButton("Select JPG", 330, 25, 100, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Messages && commit button", 10, 70, 430, 50)
$msg_label = GUICtrlCreateLabel("All systems are go.", 20, 93, 300, 25, $SS_LEFTNOWORDWRAP)
$commit_button = GUICtrlCreateButton("Commit", 330, 85, 100, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetState($commit_button, $GUI_DISABLE)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $select_picture
$picture = FileOpenDialog("Choose the new logon screen wallpaper", @DocumentsCommonDir, "Images (*.jpg)", 1)
If @error = 1 Then
$picture = ""
GUICtrlSetData($picture_label, "No picture selected.")
Else
GUICtrlSetData($picture_label, $picture)
check_picture()
EndIf
Case $commit_button
$underscore = ""
set_registry()
check_picture_destination()
copy_picture()
GUICtrlSetData($msg_label, "Picture set as new logon screen wallpaper!")
EndSwitch
;Sleep(100)
WEnd
Func copy_picture()
FileCopy($picture, $destination_file, 8)
EndFunc
Func check_picture_destination()
If FileExists($destination_path) = 0 Then
DirCreate($destination_path)
EndIf
While FileExists($destination_file) = 1
$underscore = $underscore & "_"
If FileMove($destination_file, $destination_path & "\old" & $underscore & $file) = 1 Then ExitLoop
WEnd
EndFunc
Func set_registry()
If @OSArch = "X64" Then
RegWrite("HKEY_LOCAL_MACHINE64\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", "REG_DWORD", 1)
Else
RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", "REG_DWORD", 1)
EndIf
EndFunc
Func check_picture()
$filesize = FileGetSize($picture)
If @error Then
GUICtrlSetData($msg_label, "There is a error checking the filesize.")
GUICtrlSetState($commit_button, $GUI_DISABLE)
Else
If $filesize > (250 * 1024) Then
GUICtrlSetData($msg_label, "Picture is to heavy. It has to be 256 Kb or smaller.")
GUICtrlSetState($commit_button, $GUI_DISABLE)
Else
GUICtrlSetData($msg_label, "Picture accepted.")
GUICtrlSetState($commit_button, $GUI_ENABLE)
EndIf
EndIf
EndFunc
Since I work in 64 bit, some 64-bit check where needed. And damn, that 32-bit redirection of the system32 folder is annoying
After some googeling I found that "Sysnative" works instead of "system32". This works only in 64-bit systems that want to specifically write in the "system32" folder instead of the redirected "syswow64".