#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1_1 = GUICreate('64PE多合一系统安装器 By 令狐大虾', 443, 265)
$Button1 = GUICtrlCreateButton('1、Windows 7 SP1 Ultimate', 5, 20, 210, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button2 = GUICtrlCreateButton('2、Windows 10 Enterprise', 5, 70, 210, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button3 = GUICtrlCreateButton('3、Windows 11 Enterprise', 5, 120, 210, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button4 = GUICtrlCreateButton('4、Mbr启动引导修复程序 ', 5, 170, 210, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button5 = GUICtrlCreateButton('5、Windows Server2008r2SP1',228, 20, 210, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button6 = GUICtrlCreateButton('6、Windows Server 2019', 228, 70, 210, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button7 = GUICtrlCreateButton('7、Windows Server 2022', 228, 120, 210, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button8 = GUICtrlCreateButton('8、ESP分区挂载及引导修复程序', 228, 170, 210, 30, $BS_LEFT, $WS_EX_TRANSPARENT)
$Button9 = GUICtrlCreateButton('使用说明', 195, 220, 55, 30)
$Label1 = GUICtrlCreateLabel('', 8, 228, 175, 30, $BS_LEFT)
$Label2 = GUICtrlCreateLabel('QQ:425283 微信:D286688496', 265, 228, 175, 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 7 SP1 Ultimate
$msg = MsgBoxE(3+64, '','Windows 7 SP1 Ultimate 可选全自动安装程序'&@CRLF&@CRLF&'警告:程序将格式化C盘、请预先备份好资料、并确认PE下C盘为可安装系统分区后再运行!', 0, '', '常规版', '魔改版', '退出', '',0)
Select
Case $msg = 6
RunWait(@ComSpec & ' /c ' & 'format c:/fs:ntfs /q /x /y');==>格式化C盘
Case $msg = 7
Case $msg = 2
;==>退出
EndSelect
;============================================================================================================================
Case $Button2 ;2、Windows 10 Enterprise
;============================================================================================================================
Case $Button3 ;3、Windows 11 Enterprise
;============================================================================================================================
Case $Button4 ;4、Mbr启动引导修复程序
;============================================================================================================================
Case $Button5;5、Windows Server 2008 r2 SP1
;============================================================================================================================
Case $Button6 ;6、Windows Server 2019
;============================================================================================================================
Case $Button7 ;Windows Server 2022
;============================================================================================================================
Case $Button8 ;ESP分区挂载及引导修复程序
;============================================================================================================================
Case $Button9 ;9、使用说明
;============================================================================================================================
EndSwitch
WEnd
;复制进度条
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
;总体$msg = MsgBoxE 位置和文字
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