#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=..\..\..\autoit3\Aut2Exe\Icons\Setup.ico
#AutoIt3Wrapper_outfile=E:\软件安装器\softins.exe
#AutoIt3Wrapper_Res_Comment=by 3mile
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <file.au3>
#include <array.au3>
#include <GuiTreeView.au3>
#include <GuiButton.au3>
;#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=D:\01.18传送\2.1\softins\Form1.kxf
$Form1 = GUICreate("3mile软件安装管理器", 868, 607, 97, 45)
$Pic1 = GUICtrlCreatePic("1.jpg", 0, 0, 868, 100)
Local $iStyle = BitOR($TVS_LINESATROOT, $TVS_NOHSCROLL, $TVS_NOTOOLTIPS, $TVS_FULLROWSELECT, $TVS_CHECKBOXES, $TVS_HASLINES)
$TreeView1 = GUICtrlCreateTreeView(0, 102, 300, 441, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetBkColor($TreeView1, 0x40e0d0)
_GUICtrlTreeView_SetLineColor($TreeView1, $COLOR_red)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$ListView1 = GUICtrlCreateListView("1|2|3", 305, 104, 550, 411)
_GUICtrlListView_SetColumnWidth($ListView1, 0, 60)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 200)
_GUICtrlListView_SetColumnWidth($ListView1, 2, 0)
$lable = GUICtrlCreateLabel("", 305, 520, 617, 21)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1)
Dim $StatusBar1_PartsWidth[3] = [50, 100, -1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, "", 0)
_GUICtrlStatusBar_SetText($StatusBar1, "", 1)
_GUICtrlStatusBar_SetText($StatusBar1, "", 2)
$Button1 = GUICtrlCreateButton("Button1", 80, 552, 113, 33)
$Button2 = GUICtrlCreateButton("Button2", 272, 552, 145, 33)
$Button3 = GUICtrlCreateButton("Button3", 496, 552, 137, 33)
;GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$formsub = GUICreate("", 810, 30, 100, 680, $WS_POPUP, -1)
$pe = GUICtrlCreateProgress(10, 10, 800, 20)
GUISetState(@SW_HIDE, $formsub)
GUISetState(@SW_SHOW, $Form1)
$type = IniReadSection("softinst.ini", "type")
Local $number = UBound($type) - 1
$img = _GUIImageList_Create(32, 32, 5, 3)
For $x = 6 To 15
_GUIImageList_AddIcon($img, "shell32.dll", $x, True)
_GUICtrlTreeView_SetNormalImageList($TreeView1, $img)
Next
Local $hItem[10], $hImage[10], $listview[100], $hItemsub[100]
_GUICtrlTreeView_BeginUpdate($TreeView1)
For $i = 1 To $type[0][0]
$hItem[$i] = _GUICtrlTreeView_Add($TreeView1, 0, $type[$i][1], $img, $img)
$img = Random(0, 5, 1)
$subtype = IniReadSection("softinst.ini", $type[$i][1] & ".LIST")
For $b = 1 To $subtype[0][0]
$img = Random(1, 5, 1)
$hItemsub[$b] = _GUICtrlTreeView_AddChild($TreeView1, $hItem[$i], $subtype[$b][1], $img, $img)
$subname = $subtype[$b][1]
$subcheck = IniRead("softinst.ini", $subname, "Checked", "error")
If $subcheck = 1 Then
_GUICtrlTreeView_SetChecked($TreeView1, _GUICtrlTreeView_FindItem($TreeView1, $subname), True)
EndIf
Next
Next
_GUICtrlTreeView_EndUpdate($TreeView1)
_GUICtrlTreeView_Expand($TreeView1)
_GUICtrlTreeView_SelectItem($TreeView1, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
button()
EndSwitch
WEnd
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
$hWndTreeView = GUICtrlGetHandle($TreeView1)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndTreeView
Switch $iCode
Case -451
$item = _GUICtrlTreeView_GetSelection($hWndTreeView)
$root = $item
$txt = _GUICtrlTreeView_GetText($hWndTreeView, $item)
Do
$parent = _GUICtrlTreeView_GetParentHandle($hWndTreeView, $item)
If $parent <> 0 Then
$item = $parent
$info = IniRead("softinst.ini", $txt, "Description", "error")
GUICtrlSetData($lable, $info)
;$check1=_GUICtrlTreeView_GetChecked($hwndTreeView, $item)
;MsgBox(0,0,$check1)
EndIf
Until $parent = 0
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
Func button()
$delete=_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
;MsgBox(0,0,$delete)
Dim $arr[1]
Dim $filename[1]
For $check = 1 To $type[0][0]
$chlidnumber = _GUICtrlTreeView_GetChildCount($TreeView1, $hItem[$check])
For $c = 1 To $chlidnumber
$key = _GUICtrlTreeView_GetItemByIndex($TreeView1, $hItem[$check], $c - 1)
If _GUICtrlTreeView_GetChecked($TreeView1, $key) Then
$soft = IniReadSection("softinst.ini", _GUICtrlTreeView_GetText($TreeView1, $key))
_ArrayAdd($filename, _GUICtrlTreeView_GetText($TreeView1, $key))
_ArrayAdd($arr, @ScriptDir & "" & $soft[4][1])
EndIf
Next
Next
$arr[0] = Number(UBound($arr) - 1)
$filename[0] = Number(UBound($filename) - 1)
Dim $file2[$arr[0]][3]
$ico = _GUIImageList_Create(1,25)
;_GUIImageList_AddIcon($ico, "cancel.ico")
;_GUIImageList_AddIcon($ico, "hot.ico")
_GUICtrlListView_SetImageList($listview1, $ico,1)
For $e = 1 To $arr[0]
$file2[$e - 1][0] = "安装"
$file2[$e - 1][1] = $filename[$e]
$file2[$e - 1][2] = $arr[$e]
Next
For $p = 1 To $arr[0]
;MsgBox(0,0,$file2[$p][1])
_GUICtrlListView_AddItem($ListView1, "安装", 1)
;_GUICtrlListView_AddSubItem($listview1,$p-1,$file2[$p-1][1],1)
_GUICtrlListView_AddSubItem($ListView1, $p - 1, $filename[$p], 1, 1)
_GUICtrlListView_AddSubItem($ListView1, $p - 1, $arr[$p],2,1)
Next
For $se = 1 To $arr[0]
_GUICtrlListView_SetItemText($ListView1, $se - 1, "√", 0)
_GUICtrlListView_SetItemSelected($listview1,$se-1)
If $se>8 Then _GUICtrlListView_Scroll($listview1, 0, 15)
GUICtrlSetData($pe, $se * (100 / $arr[0]))
;GUISetState(@SW_HIDE,$Form1)
GUISetState(@SW_SHOW, $formsub)
;MsgBox(0,0,_GUICtrlListView_GetItemText($listview1,$se-1)
Sleep(400)
;MsgBox(0,0,_GUICtrlListView_GetItemText($ListView1, $se - 1, 2),1)
;ShellExecuteWait(_GUICtrlListView_GetItemText($ListView1, $se - 1, 2),1)
Next
;GUISetState(@SW_SHOW,$Form1)
GUISetState(@SW_HIDE, $formsub)
;GUICtrlSetState($lable, $GUI_HIDE)
;GUICtrlSetState($ListView1, $GUI_show)
;MsgBox(0, 0, "完成")
EndFunc