#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_x64=x64.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Res_Description=AutoInstall_x64
#AutoIt3Wrapper_Res_Fileversion=0.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=令狐大虾
#AutoIt3Wrapper_Res_Language=2052
#AutoIt3Wrapper_Res_requestedExecutionLevel=None
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Antidecompile=y
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1_1 = GUICreate('多合一系统安装器 By 令狐大虾', 420, 150)
$Button1 = GUICtrlCreateButton('1、Windows XP SP3 Professional', 5, 20, 195, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button2 = GUICtrlCreateButton('2、Windows 2003 SP2 Enterprise', 5, 70, 195, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button3 = GUICtrlCreateButton('3、Ghost手动备份和恢复程序', 220, 20, 195, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button4 = GUICtrlCreateButton('使用说明', 220, 70, 55, 30, $BS_LEFT)
$Label1 = GUICtrlCreateLabel('', 5, 120, 195, 30, $BS_LEFT)
$Label2 = GUICtrlCreateLabel('QQ:425283 微信:D286688496', 220, 120, 195, 30, $BS_LEFT)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
;============================================================================================================================
Case $Button1 ;1、Windows XP SP3 Professional
$msg = MsgBoxE(3 + 64, '', 'Windows XP SP3 Professional全自动安装程序' & @CRLF & @CRLF & '警告:程序将格式化C盘、请预先备份好资料、并确认PE下C盘为可安装系统分区后再运行!', 0, '', 'wim安装版', 'i386版', '退出', '', 0)
Select
Case $msg = 6
;复制进度条
_DirCopy(@UserProfileDir & '\桌面','D:\My Documents\')
Func _DirCopy($SourceDir,$Destdir)
Local $Shell
Local $FOF_SIMPLEPROGRESS = 16
If Not FileExists($Destdir) Then DirCreate($Destdir)
$Shell = ObjCreate("shell.application")
$Shell.namespace($Destdir).CopyHere($SourceDir,$FOF_SIMPLEPROGRESS)
EndFunc
Case $msg = 7
Case $msg = 2
;退出
EndSelect
;============================================================================================================================
Case $Button2 ;2、Windows 2003 SP2 Enterprise
$msg = MsgBoxE(3 + 64, '', 'Windows 2003 SP2 Enterprise全自动安装程序' & @CRLF & @CRLF & '警告:程序将格式化C盘、请预先备份好资料、并确认PE下C盘为可安装系统分区后再运行!', 0, '', 'wim安装版', 'i386版', '退出', '', 0)
Select
Case $msg = 6
Case $msg = 7
Case $msg = 2
;退出
EndSelect
;============================================================================================================================
Case $Button3 ;3、Ghost手动备份和恢复程序
$msg = MsgBoxE(3 + 64, '提示', 'Ghost手动备份和恢复程序', 0, '', 'Ghost32', 'GhostZ9', '退出', '', 100)
Select
Case $msg = 6
Case $msg = 7
Case $msg = 2
;==>退出
EndSelect
;============================================================================================================================
Case $Button4 ;使用说明
FileInstall('相关调用\03PE多合一系统安装器使用说明.txt', @TempDir & '\', 1)
If FileExists(@TempDir & '\03PE多合一系统安装器使用说明.txt') Then ShellExecute(@TempDir & '\03PE多合一系统安装器使用说明.txt')
;============================================================================================================================
;总体$msg = MsgBoxE 位置和文字
;============================================================================================================================
EndSwitch
WEnd
Func MsgBoxE($flag, $title, $text, $timeout = 0, $hwnd = '', $Button1 = '', $Button2 = '', $Button3 = '', $x = '', $y = '')
; 参数加在 title 后面传递给 MB__CallBack,避免使用全局变量
$title &= @CRLF & 'B1=' & $Button1 & @CRLF & 'B2=' & $Button2 & @CRLF & 'B3=' & $Button3 & @CRLF & 'x=' & $x & @CRLF & 'y=' & $y
Local $hGUI = GUICreate("")
Local $sFuncName = "GetWindowLongW"
If @AutoItX64 Then $sFuncName = "GetWindowLongPtrW"
Local $aResult = DllCall("user32.dll", "long_ptr", $sFuncName, "hwnd", $hGUI, "int", -6)
Local $hInst = $aResult[0]
$aResult = DllCall("kernel32.dll", "dword", "GetCurrentThreadId")
Local $iThreadId = $aResult[0]
Local $hCallBack = DllCallbackRegister("MB__CallBack", "int", "int;hWnd;ptr")
Local $pCallBack = DllCallbackGetPtr($hCallBack)
$aResult = DllCall("user32.dll", "handle", "SetWindowsHookEx", "int", 5, "ptr", $pCallBack, "handle", $hInst, "dword", $iThreadId)
Local $hHook = $aResult[0]
Local $msg = MsgBox($flag, $title, $text, $timeout, $hwnd)
GUIDelete($hGUI)
DllCall("user32.dll", "bool", "UnhookWindowsHookEx", "handle", $hHook)
DllCallbackFree($hCallBack)
Return $msg
EndFunc ;==>MsgBoxE
Func MB__CallBack($iCode, $wParam, $lParam)
;~ ConsoleWrite('$iCode=' & $iCode & ', $wParam=' & $wParam & ', $lParam=' & $lParam & @CRLF)
If $iCode = 5 Then
Local $title = WinGetTitle($wParam)
If Not StringInStr($title, @CRLF & 'B1=') Then Return
Local $match = StringRegExp($title, '(?i)\r\nB1=(.*)\r\nB2=(.*)\r\nB3=(.*)\r\nx=(.*)\r\ny=(.*)', 1)
If @error Then Return
; 改回 title
$title = StringRegExpReplace($title, '(?i)(?s)\r\nB1=.*', '')
WinSetTitle($wParam, '', $title)
; 移动 MsgBox 位置
If $match[3] <> '' Or $match[4] <> '' Then
If $match[3] = '' Then $match[3] = Default
If $match[4] = '' Then $match[4] = Default
WinMove($wParam, '', $match[3], $match[4])
EndIf
; 修改按钮文字
If $match[0] <> '' Then ControlSetText($wParam, '', 'Button1', $match[0])
If $match[1] <> '' Then ControlSetText($wParam, '', 'Button2', $match[1])
If $match[2] <> '' Then ControlSetText($wParam, '', 'Button3', $match[2])
EndIf
EndFunc ;==>MB__CallBack