本帖最后由 快乐100 于 2011-8-23 10:39 编辑
au3开机画面修改源码
最近学AU3,做了个开机画面的修改工具,用于XP,通过常用的方法修改,大家想用就可以复制,不多说啦,上图:
选择好图片和启动时间就按“应用”,当然修改后可以按“还原”键还原,关键是你想不想还原了。修改后重启看看,变了吧。
源代码:
-
- #NoTrayIcon
- #Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_icon=D:\Program Files\AU3\Aut2Exe\Icons\apps.ico
- #AutoIt3Wrapper_outfile=开机画面修改工具.EXE
- #AutoIt3Wrapper_Compression=4
- #AutoIt3Wrapper_UseAnsi=y
- #AutoIt3Wrapper_Allow_Decompile=n
- #AutoIt3Wrapper_Res_Comment=博客地址:http://hi.baidu.com/辰cheng_ 欢迎访问
- #AutoIt3Wrapper_Res_Description=开机画面修改
- #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
- #AutoIt3Wrapper_Res_LegalCopyright=辰cheng制作
- #EndRegion ;**** 参数创建于 AutoIt3Wrapper_GUI ****
- #Region ;**** 参数创建于 ACNWrapper_GUI ****
- #EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
- #include <ButtonConstants.au3>
- #include <EditConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- #Region ### START Koda GUI section ### Form=
- $Form1 = GUICreate("开机画面修改工具", 295, 140)
- $Label1 = GUICtrlCreateLabel("注意:请选择一张大小为640*480*16色的图片!", 24, 16, 262, 20)
- GUICtrlSetTip(-1, "在Photoshop中新建一个大小640*480全黑的图层做背景" & @CRLF & "然后将自己喜欢的图片放到黑色的图层上图片模式改为索引"& @CRLF &"保存时选择16色(即4位)bmp图片")
- GUICtrlSetCursor(-1, 0)
- GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
- GUICtrlSetColor(-1, 0x800000)
- $Input1 = GUICtrlCreateInput("", 24, 48, 201, 21)
- $Button1 = GUICtrlCreateButton("选 择", 228, 47, 38, 21, $WS_GROUP)
- $Label2 = GUICtrlCreateLabel("启动菜单等待时间(秒):", 24, 80, 129, 17)
- $Input2 = GUICtrlCreateInput("3", 152, 78, 33, 17)
- $Button2 = GUICtrlCreateButton("应 用", 24, 110, 75, 22, $WS_GROUP)
- $Button3 = GUICtrlCreateButton("还 原", 152, 110, 75, 22, $WS_GROUP)
- GUICtrlSetState(-1, $GUI_DISABLE)
- $Label3 = GUICtrlCreateLabel("辰cheng", 232, 116, 46, 17)
- GUICtrlSetState(-1, $GUI_DISABLE)
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- $Win = Stringtrimleft(@windowsdir, 3)
- if regread("HKLM\SYSTEM\CurrentControlSet\Control", "SystemBootDevice") = '' then
- $default = "multi(0)disk(0)rdisk(0)partition(1)" & $Win
- else
- $default = regread("HKLM\SYSTEM\CurrentControlSet\Control", "SystemBootDevice") & "" & $Win
- endif
- $Result = iniread(@homedrive & "\boot.ini", "operating systems", $default, "")
- $addresult = $Result & " /bootlogo /noguiboot"
- If FileExists(@WindowsDir & "\boot.bmp") And Stringinstr($Result, "/bootlogo /noguiboot") then
- GUICtrlSetState($Button3, $GUI_ENABLE)
- EndIf
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Exit
- Case $Button1
- $ButtonInput1 = FileOpenDialog("", "", "(*.bmp)", "9")
- GUICtrlSetData($Input1, $ButtonInput1)
- Case $Button2
- GUICtrlSetState($Button2, $GUI_DISABLE)
- GUICtrlSetState($Button3, $GUI_DISABLE)
- FileCopy(GUICtrlRead($Input1), @WindowsDir & "\boot.bmp", 1)
- FileSetAttrib(@HomeDrive & "\boot.ini", "-HSR")
- if Stringinstr($Result, $addresult) = 0 then
- iniwrite(@homedrive & "\boot.ini", "operating systems", $default, $addresult)
- EndIf
- iniwrite(@homedrive & "\boot.ini", "boot loader", "timeout", GUICtrlRead($Input2))
- FileSetAttrib(@WindowsDir & "\boot.bmp", "+HSR")
- FileSetAttrib(@HomeDrive & "\boot.ini", "+HSR")
- WinWaitActive("开机画面修改工具")
- WinSetTitle("开机画面修改工具", "", "设置完毕请重启计算机查看效果")
- Case $Button3
- GUICtrlSetState($Button2, $GUI_DISABLE)
- GUICtrlSetState($Button3, $GUI_DISABLE)
- FileSetAttrib(@WindowsDir & "\boot.bmp", "-HSR")
- FileDelete (@WindowsDir & "\boot.bmp")
- FileSetAttrib(@HomeDrive & "\boot.ini", "-HSR")
- $var=IniReadSection (@homedrive & "\boot.ini", "operating systems")
- ;MsgBox(4096, "", "关键字: " & $var[1][0] & @CRLF & "值: " & $var[1][1])
- $qqq=StringTrimRight ($var[1][1], 20)
- IniWrite(@homedrive & "\boot.ini", "operating systems", $var[1][0],$qqq)
- FileSetAttrib(@HomeDrive & "\boot.ini", "+HSR")
- WinWaitActive("开机画面修改工具")
- WinSetTitle("开机画面修改工具", "", "设置完毕请重启计算机查看效果")
- EndSwitch
- WEnd
复制代码 |