Hey Leute,
ich habe mal ein "kleines" Problem. Schon habe ich "Kirjaudu" fertiggestellt, funktioniert es nicht. Jedenfalls nicht ganz. Beim ersten Start funktioniert es, dann aber nicht mehr. Ich musste das Programm sogar noch einmal schreiben, aber es geht trotzdem nicht. Hier ist das Script:
[autoit]#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\Icons\Basic\Basic_set2_Win\photo.ico
#AutoIt3Wrapper_Outfile=Kirjaudu.exe
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Comment=Change your Login Wallpaper in Finish
#AutoIt3Wrapper_Res_Description=Kirjaudu
#AutoIt3Wrapper_Res_Fileversion=1.1
#AutoIt3Wrapper_Res_LegalCopyright=(C) LimeSoft Solutions 2012
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
_GDIPlus_Startup()
#region ### START Koda GUI section ### Form=C:\Users\Administrator\Documents\StevenX Media\Kirjaudu\1.1\Gui1.kxf
$Form1 = GUICreate("Kirjaudu 1.1", 628, 338, 192, 124)
$Label1 = GUICtrlCreateLabel("Kirjaudu", 232, 24, 148, 49)
GUICtrlSetFont(-1, 30, 400, 0, "Myriad")
$Start_1 = GUICtrlCreateButton("Click to start", 24, 136, 569, 89)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Start_1
GUISetState(@SW_HIDE, $Form1)
$Photo_File = FileOpenDialog("Open the Photo", "", "JPG Photo(*.jpg)")
_GUI2()
EndSwitch
WEnd
Func _GUI2()
#region ### START Koda GUI section ### Form=c:\users\administrator\documents\stevenx media\kirjaudu\1.1\gui2.kxf
$Kirjaudu2 = GUICreate("Kirjaudu 1.1", 630, 453, 309, 100)
$Group1 = GUICtrlCreateGroup("File Informations", 32, 32, 569, 337)
$Photo_Dim_L = GUICtrlCreateLabel("Photo Dimensions:", 40, 64,100,100)
$Photo_Size_L = GUICtrlCreateLabel("Photo Size:", 40, 104,100,100)
$Desktop_Dim_L = GUICtrlCreateLabel("Desktop Dimensions:", 40, 144,100,100)
$Ready_L = GUICtrlCreateLabel("Status:", 40, 176,100,100)
$Pic1 = GUICtrlCreatePic ("", 328, 64, 265,250)
$Photo_Label = GUICtrlCreateLabel("Photo Path: ", 200, 328,500)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Start_Button = GUICtrlCreateButton("Start", 32, 384, 209, 41)
$Revert_Button = GUICtrlCreateButton("Back To Normal", 280, 384, 209, 41)
$Label5 = GUICtrlCreateLabel("Kirjaudu", 240, 8, 103, 36)
GUICtrlSetFont(-1, 20, 400, 0, "Myriad")
GUICtrlSetColor(-1, 0x646464)
GUISetState(@SW_SHOW, $Kirjaudu2)
GUICtrlSetImage($Pic1, $Photo_File)
$hImage = _GDIPlus_ImageLoadFromFile($Photo_File)
$Photo_width = _GDIPlus_ImageGetWidth($hImage)
$Photo_height = _GDIPlus_ImageGetHeight($hImage)
GUICtrlSetData($Photo_Label, "Photo Path: " & $Photo_File)
GUICtrlSetData($Photo_Size_L, "Photo Size: " & FileGetSize($Photo_File) / 1024 & " Kilobytes")
GUICtrlSetData($Photo_Dim_L, "Dimensions: " & $Photo_width & "X" & $Photo_height)
GUICtrlSetData($Desktop_Dim_L, "Desktop Dimensions: " & @DesktopWidth & "X" & @DesktopHeight)
If $Photo_width & "X" & $Photo_height <> @DesktopWidth & "X" & @DesktopHeight And FileGetSize($Photo_File) > 256000 Then
GUICtrlSetData($Ready_L, "Ready: The Photo size is bigger than 250 kilobytes." & @CRLF & "The Photo Dimensions are not equal with the dimensions of your Desktop. If you start, the picture will not appear.")
ElseIf FileGetSize($Photo_File) > 256000 Then
GUICtrlSetData($Ready_L, "Ready: The Photo size is bigger than 250 kilobytes. If you start, the picture will not appear.")
ElseIf $Photo_width & "X" & $Photo_height <> @DesktopWidth & "X" & @DesktopHeight Then
GUICtrlSetData($Ready_L, "Ready: The Photo Dimensions are not equal with the dimensions of your Desktop. But you can start")
Else
GUICtrlSetData($Ready_L, "Ready: You can start")
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Start_Button
DirRemove( 'C:\Windows\System32\oobe\Info\backgrounds\')
DirCreate( 'C:\Windows\System32\oobe\Info\backgrounds\')
FileDelete( 'C:\Windows\System32\oobe\Info\backgrounds\backgroundDefault.jpg')
RegDelete( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground");This is the Registry Key for the Background
$Reg = RegWrite( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", "REG_DWORD", "1")
$Copy = FileCopy( $Photo_File, 'C:\Windows\System32\oobe\Info\backgrounds\backgroundDefault.jpg',
If $Copy = 0 AND $Reg = 0 Then
MsgBox( 0+16, "ERROR", "Could not edit Registry AND could not copy photo")
ElseIf $Reg = 0 Then
MsgBox( 0+16, "ERROR", "Could not edit Registry")
ElseIf $Copy = 0 Then
MsgBox( 0+16, "ERROR", "Could not copy photo")
Else
MsgBox( 0+64, "Successful", "Finished successfully")
EndIf
Case $Revert_Button
$Reg_Del = RegDelete( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground")
$Reg = RegWrite( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", "REG_DWORD", "0")
If $Reg_Del = 0 AND $Reg = 0 Then
MsgBox( 0+16, "ERROR", "Could not edit Registry AND could not copy photo")
ElseIf $Reg = 0 Then
MsgBox( 0+16, "ERROR", "Could not edit Registry")
ElseIf $Reg_Del = 0 Then
MsgBox( 0+16, "ERROR", "Could not copy photo")
Else
MsgBox( 0+64, "Successful", "Finished successful")
EndIf
EndSwitch
WEnd
EndFunc ;==>_GUI2
Der wesentliche Teil ist dieser:
[autoit]DirRemove( 'C:\Windows\System32\oobe\Info\backgrounds\')
DirCreate( 'C:\Windows\System32\oobe\Info\backgrounds\')
FileDelete( 'C:\Windows\System32\oobe\Info\backgrounds\backgroundDefault.jpg')
RegDelete( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground");This is the Registry Key for the Background
$Reg = RegWrite( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background", "OEMBackground", "REG_DWORD", "1")
$Copy = FileCopy( $Photo_File, 'C:\Windows\System32\oobe\Info\backgrounds\backgroundDefault.jpg',
If $Copy = 0 AND $Reg = 0 Then
MsgBox( 0+16, "ERROR", "Could not edit Registry AND could not copy photo")
ElseIf $Reg = 0 Then
MsgBox( 0+16, "ERROR", "Could not edit Registry")
ElseIf $Copy = 0 Then
MsgBox( 0+16, "ERROR", "Could not copy photo")
Else
MsgBox( 0+64, "Successful", "Finished successfully")
EndIf
Ich hoffe, ihr könnt mir helfen.
MFG,
Stevenx