Jump to content

LoginBkgSet UDF


JobEst
 Share

Recommended Posts

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

Edited by JobEst

do something best~

Link to comment
Share on other sites

Very nice!

This line:

_LoginBkgSet(@ScriptDir&"Demo.jpg", 2, 1)
should look like:
_LoginBkgSet(@ScriptDir & "Demo.jpg", 2, 1)

See also my program:

Regards,

João Carlos.

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Very nice!

This line:

_LoginBkgSet(@ScriptDir&"Demo.jpg", 2, 1)
should look like:
_LoginBkgSet(@ScriptDir & "Demo.jpg", 2, 1)

See also my program: ?do=embed' frameborder='0' data-embedContent>

Regards,

João Carlos.

Thank you ! João Carlos.

I will correct it .

I have seen your program: ?do=embed' frameborder='0' data-embedContent> very useful ~ ;)

Regards,

JobEst

do something best~

Link to comment
Share on other sites

Nice one, but I don't think it can work with earlier(starter/milestone) builds of win7... MS introduced this feature quite later... Am I right?

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Link to comment
Share on other sites

Nice one, but I don't think it can work with earlier(starter/milestone) builds of win7... MS introduced this feature quite later... Am I right?

Maybe . I don't test it on earlier(starter/milestone) builds of win7... ;)

do something best~

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...