Hello, Guys.
This UDF can change your background of login screen for Win7 freely, which can take effect immediately after this function has been performed successfully If you want to view the result, please press Win + L key combination ~
I just learn AU3 for a short time and not good at it ,so please let me know if you have some suggestion about this UDF
Best Regards,
JobEst
#include-once
; #Function# =============================================================
; name...........: _LoginBkgSet
; description ...: change the background of login screen for Win 7 freely
; syntax.........: _LoginBkgSet($sImgPath, $iButtonFront = 0, $iOverWrite = 1)
; parameters ....: $sImgPath - The source path of the Img file to change. (usually picture format is .Jpg format)
; $iButtonFront - this parameter determines which style of Button and front will be used
; |0 - gray opaque button , no shadow front (default)
; |1 – gray subtransparent button , shadow front
; |2 – color opaque button , no shadow front
; $iOverWrite - this parameter determines whether to overwrite Img file if they already exist.
; |0 - do not overwrite existing Img file
; |1 –overwrite existing Img file (default)
; Return Value ......: success – Return a 1
; failure - Return a 0 and set @error as follows:
; @error - 1 = this function is not suitable for this system.
; 2 = Img file (path) is not exsiting
; 3 = Picture format is not .Jpg format
; 4 = size for Img file exceed 255 kilobyte
; 5 =$iButttonSet or $iOverWrite parameter is invalid
; 6 = unable to write requested value
; 7 =unable to copy requested Img file
; Author ........: lujd0429 <www.autoitx.com>
; Remarks .......: The background of login screen changed for Win 7 will take effect immediately after this function has been performed successfully If you want to view the result, please press Win + L key combination ~
; =======================================================================
Func _LoginBkgSet($sImgPath, $iButtonFront = 0, $iOverWrite = 1)
If Not @OSVersion == "Win_7" Then
Return SetError(1,0,0)
Else
; check if Img file(path) is exsiting
If FileExists($sImgPath) = 0 Then Return SetError(2,0,0)
; check if the extension of Img file is .jpg format
$sSplitPath = StringSplit($sImgPath, "." , 1)
If Not($sSplitPath[($sSplitPath[0])] == "jpg" OR "JPG" OR "jpeg" OR "JPEG") Then Return SetError(3,0,0)
[color=#008000] ; check if size for Img files exceed 255 kilobyte[/color]
If (FileGetSize($sImgPath)/1024) > 255 Then Return SetError(4,0,0)
If @OSArch == "X64" Then
$sOSArch = "64"
Else
$sOsArch = ""
Endif
; check if $ButttonSet or $OverWrite parameter is integral value
If Not (IsInt($iButtonFront) And IsInt($iOverWrite)) Then Return SetError(5,0,0)
Local $Return = ""
$Return = RegWrite("HKLM"&$sOsArch&"SOFTWAREMicrosoftWindowsCurrentVersionAuthenticationLogonUI","ButtonSet","REG_DWORD",$iButtonFront) And _
RegWrite("HKLM"&$sOsArch&"SOFTWAREMicrosoftWindowsCurrentVersionAuthenticationLogonUIBackground","OEMBackground","REG_DWORD",1)
If Not ($Return = 1) Then Return SetError(6,0,0)
$Return = FileCopy($sImgPath,@SystemDir&"oobeInfoBackgroundsbackgroundDefault.jpg",($iOverWrite) + 8)
If Not ($Return = 1) Then Return SetError(7,0,0)
Endif
Return $Return
EndFunc
#include "LoginBkgSet.au3"
_LoginBkgSet(@ScriptDir & "Demo.jpg", 2, 1)LoginBkgSet.au3