#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListBox.au3>
#include <GuiTreeView.au3>
#Include <Array.au3>
#Region ### START Koda GUI section ### Form=e:\jonyau3\移动实用工具\彩铃设置.kxf
$Form1 = GUICreate("彩铃设置工具", 733, 512, -1, -1)
$Group1 = GUICtrlCreateGroup("", 8, 0, 721, 505, -1, $WS_EX_TRANSPARENT)
$Tab1 = GUICtrlCreateTab(16, 8, 697, 457)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("开始菜单桌面类")
$Group2 = GUICtrlCreateGroup("显示选项", 24, 40, 369, 273)
$Group3 = GUICtrlCreateGroup("全部选项", 32, 56, 169, 249)
$TvStrat = GUICtrlCreateTreeView(37, 72, 158, 225, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES, $WS_GROUP, $WS_TABSTOP))
Dim $Father[1], $Son[1],$Number
Dim $FatherArray[6] = [5, "程序列表类", "Windows Update 链接", "用户文件夹类", "系统应用类", "其他类"]
Dim $SonArray[5][10] = [[4, "附加的程序列表", "常用程序列表", "更多程序列表", "公用程序列表"],[1, "Windows Update 链接"], _
[7, "我的文档", "图片收藏", "我的音乐", "最近使用的文档", "我的电脑", "网上邻居", "用户名"],[3, "控制面板", _
"网络连接", "打印机传真"],[8, "帮助", "搜索", "运行", "注销", "关闭计算机", "设定程序访问和默认值", "开始菜单右键(禁止)", "任务栏右键(禁止)"]]
For $i = 1 To 5
$hFatherItem = GUICtrlCreateTreeViewItem($FatherArray[$i], $TvStrat)
_ArrayAdd($Father, $hFatherItem)
For $j = 1 To $SonArray[$i - 1][0]
$hSonItem = GUICtrlCreateTreeViewItem($SonArray[$i-1][$j], $hFatherItem)
_ArrayAdd($Son, $hSonItem)
Next
Next
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("显示启用选项", 208, 56, 177, 217)
$LsStrat = GUICtrlCreateList("", 216, 72, 161, 188)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$BtnStrat = GUICtrlCreateButton("应用", 280, 280, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group14 = GUICtrlCreateGroup("桌面系统图标", 399, 38, 305, 273)
$Group15 = GUICtrlCreateGroup("全部默认图标", 407, 54, 137, 249)
$TvDesktop = GUICtrlCreateTreeView(412, 70, 126, 225, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES, $WS_GROUP, $WS_TABSTOP))
$TvDesktop_0 = GUICtrlCreateTreeViewItem("系统图标类", $TvDesktop)
$TvDesktop_1 = GUICtrlCreateTreeViewItem("我的文档", $TvDesktop_0)
$TvDesktop_2 = GUICtrlCreateTreeViewItem("我的电脑", $TvDesktop_0)
$TvDesktop_3 = GUICtrlCreateTreeViewItem("网上邻居", $TvDesktop_0)
$TvDesktop_4 = GUICtrlCreateTreeViewItem("Internet Explorer", $TvDesktop_0)
$TvDesktop_5 = GUICtrlCreateTreeViewItem("回收站", $TvDesktop_0)
$TvDesktop_6 = GUICtrlCreateTreeViewItem("Windows Mider", $TvDesktop_0)
$TvDesktop_7 = GUICtrlCreateTreeViewItem("桌面鼠标右键(禁用)", $TvDesktop)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group16 = GUICtrlCreateGroup("显示图标", 551, 54, 145, 217)
$LsDesktop = GUICtrlCreateList("", 560, 72, 129, 188)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$BtnDesktop = GUICtrlCreateButton("应 用", 599, 278, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group18 = GUICtrlCreateGroup("说明", 24, 320, 681, 137)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet2 = GUICtrlCreateTabItem("IE设置类")
$Group5 = GUICtrlCreateGroup("IE标准按钮", 24, 32, 329, 273)
$Group6 = GUICtrlCreateGroup("全部按钮", 32, 48, 153, 249)
$TvIE = GUICtrlCreateTreeView(37, 64, 142, 225, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES, $WS_GROUP, $WS_TABSTOP))
$TvIE_0 = GUICtrlCreateTreeViewItem("标准按钮类", $TvIE)
$TvIE_1 = GUICtrlCreateTreeViewItem("后退", $TvIE_0)
$TvIE_2 = GUICtrlCreateTreeViewItem("前进", $TvIE_0)
$TvIE_3 = GUICtrlCreateTreeViewItem("停止", $TvIE_0)
$TvIE_4 = GUICtrlCreateTreeViewItem("刷新", $TvIE_0)
$TvIE_5 = GUICtrlCreateTreeViewItem("主页", $TvIE_0)
$TvIE_6 = GUICtrlCreateTreeViewItem("搜索", $TvIE_0)
$TvIE_7 = GUICtrlCreateTreeViewItem("文件夹", $TvIE_0)
$TvIE_8 = GUICtrlCreateTreeViewItem("收藏夹", $TvIE_0)
$TvIE_9 = GUICtrlCreateTreeViewItem("多媒体", $TvIE_0)
$TvIE_10 = GUICtrlCreateTreeViewItem("历史", $TvIE_0)
$TvIE_11 = GUICtrlCreateTreeViewItem("全屏", $TvIE_0)
$TvIE_12 = GUICtrlCreateTreeViewItem("工具", $TvIE_0)
$TvIE_13 = GUICtrlCreateTreeViewItem("邮件", $TvIE_0)
$TvIE_14 = GUICtrlCreateTreeViewItem("字体", $TvIE_0)
$TvIE_15 = GUICtrlCreateTreeViewItem("打印", $TvIE_0)
$TvIE_16 = GUICtrlCreateTreeViewItem("编辑", $TvIE_0)
$TvIE_17 = GUICtrlCreateTreeViewItem("讨论", $TvIE_0)
$TvIE_18 = GUICtrlCreateTreeViewItem("剪切", $TvIE_0)
$TvIE_19 = GUICtrlCreateTreeViewItem("复制", $TvIE_0)
$TvIE_20 = GUICtrlCreateTreeViewItem("粘贴", $TvIE_0)
$TvIE_21 = GUICtrlCreateTreeViewItem("编码", $TvIE_0)
$TvIE_22 = GUICtrlCreateTreeViewItem("打印预览", $TvIE_0)
$TvIE_23 = GUICtrlCreateTreeViewItem("工具栏类", $TvIE)
$TvIE_24 = GUICtrlCreateTreeViewItem("自定义按钮(删除)", $TvIE_23)
$TvIE_25 = GUICtrlCreateTreeViewItem("锁定工具栏", $TvIE_23)
$TvIE_26 = GUICtrlCreateTreeViewItem("菜单栏(删除)", $TvIE)
$TvIE_27 = GUICtrlCreateTreeViewItem("地址栏(删除)", $TvIE)
$TvIE_28 = GUICtrlCreateTreeViewItem("鼠标右键(禁止)", $TvIE)
$TvIE_29 = GUICtrlCreateTreeViewItem("安全选项", $TvIE)
$TvIE_30 = GUICtrlCreateTreeViewItem("Internet(启动)", $TvIE_29)
$TvIE_31 = GUICtrlCreateTreeViewItem("本地Internet(启动)", $TvIE_29)
$TvIE_32 = GUICtrlCreateTreeViewItem("受信任站点(启动)", $TvIE_29)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group7 = GUICtrlCreateGroup("显示按钮", 192, 48, 153, 217)
$LsIE = GUICtrlCreateList("", 200, 64, 137, 188)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$BtnIE = GUICtrlCreateButton("应 用", 232, 272, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group8 = GUICtrlCreateGroup("网站设置", 360, 32, 345, 273)
$CobBelong = GUICtrlCreateCombo("", 608, 56, 89, 25)
GUICtrlSetData(-1, "主页|桌面|收藏夹|受信任站点|隐私站点|代理例外|代理服务器", "主页")
$InpWWW = GUICtrlCreateInput("InpWWW", 391, 56, 105, 21)
$Label1 = GUICtrlCreateLabel("网址", 363, 60, 28, 17)
$Label2 = GUICtrlCreateLabel("名字", 498, 60, 28, 17)
$InpName = GUICtrlCreateInput("InpName", 524, 56, 73, 21)
$LvWWW = GUICtrlCreateListView("|网址|名字|属于", 368, 88, 274, 206, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 20)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 70)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 80)
$BtnWWWAdd = GUICtrlCreateButton("增加", 648, 104, 51, 25)
$BtnWWWDel = GUICtrlCreateButton("删除", 648, 144, 51, 25)
$BtnWWW = GUICtrlCreateButton("应用", 648, 256, 51, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group9 = GUICtrlCreateGroup("辅助设置", 24, 312, 681, 145)
$Group10 = GUICtrlCreateGroup("阻止弹出窗口", 32, 328, 89, 121)
$RdNoStop = GUICtrlCreateRadio("不阻止", 40, 352, 65, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$RdStop = GUICtrlCreateRadio("阻止", 40, 384, 57, 17)
$BtnStop = GUICtrlCreateButton("设置", 48, 416, 51, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group11 = GUICtrlCreateGroup("代理服务器", 128, 328, 81, 121)
$RdNoProxy = GUICtrlCreateRadio("不启用", 136, 352, 57, 17)
$RdProxy = GUICtrlCreateRadio("启用", 136, 384, 49, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$BtnProxy = GUICtrlCreateButton("设置", 144, 416, 51, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group12 = GUICtrlCreateGroup("本地不用代理", 216, 328, 89, 121)
$RdNoLocalProxy = GUICtrlCreateRadio("不启用", 232, 352, 65, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$RdLocalProxy = GUICtrlCreateRadio("启用", 232, 384, 57, 17)
$BtnLocalProxy = GUICtrlCreateButton("设置", 232, 416, 51, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group13 = GUICtrlCreateGroup("Windows防火墙", 312, 328, 97, 121)
$RdCloseFirewall = GUICtrlCreateRadio("彻底关闭", 328, 352, 73, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$RdFirewall = GUICtrlCreateRadio("开启", 328, 384, 65, 17)
$BtnFirewall = GUICtrlCreateButton("设置", 336, 416, 51, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group17 = GUICtrlCreateGroup("任务管理器", 416, 328, 81, 121)
$RdStopTask = GUICtrlCreateRadio("禁用", 432, 352, 49, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$RdTask = GUICtrlCreateRadio("启用", 432, 384, 49, 17)
$BtnTask = GUICtrlCreateButton("设置", 432, 416, 51, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")
$BtnOneKeySet = GUICtrlCreateButton("一键设置", 592, 472, 91, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($Form1)
Exit
Case $BtnOneKeySet
MsgBox("", "", ControlGetFocus("彩铃设置工具"))
Case $Father[1] To $Father[UBound($Father) - 1], $Son[1] To $Son[UBound($Son) - 1]
For $i = 0 To UBound($Father) - 1 ;父项目操作
If $nMsg = $Father[$i] And BitAND(GUICtrlRead($Father[$i]), $GUI_CHECKED) Then
$Number = Number(_GUICtrlTreeView_GetChildCount($TvStrat, $Father[$i])) ;全选
For $m = $Father[$i] To $Father[$i] + $Number
GUICtrlSetState($m, $GUI_CHECKED)
Next
ElseIf $nMsg = $Father[$i] And BitAND(GUICtrlRead($Father[$i]), $GUI_UNCHECKED) Then ;反选
$Number = Number(_GUICtrlTreeView_GetChildCount($TvStrat, $Father[$i]))
For $n = $Father[$i] To $Father[$i] + $Number
GUICtrlSetState($n, $GUI_UNCHECKED)
Next
EndIf
Next
For $z = 0 To UBound($Son) - 1 ;子项目操作
If $nMsg = $Son[$z] And BitAND(GUICtrlRead($Son[$z]), $GUI_CHECKED) Then ;子项目勾选,父项目跟着勾选
$Handle = _GUICtrlTreeView_GetParentParam($TvStrat, $Son[$z])
GUICtrlSetState($Handle, $GUI_CHECKED)
ElseIf $nMsg = $Son[$z] And BitAND(GUICtrlRead($Son[$z]), $GUI_UNCHECKED) Then
$Handle = _GUICtrlTreeView_GetParentParam($TvStrat, $Son[$z])
$Number = Number(_GUICtrlTreeView_GetChildCount($TvStrat, $Handle))
For $o = $Handle To $Handle + $Number
If GUICtrlRead($o) = $GUI_CHECKED Then ExitLoop
If $o = $Handle + $Number Then GUICtrlSetState($Handle, $GUI_UNCHECKED) ;子项目全部取消勾选,父项目也跟着取消勾选
Next
EndIf
Next
_TreeViewToListBox($TvStrat, $LsStrat)
EndSwitch
WEnd
Func _TreeViewToListBox($TreeView, $ListBox)
;说明
; 能把TreeView中复选框选中的项目显示到指定的ListBox中
;参数
; $TreeView -----TreeView句柄
; $ListBox -----ListBox句柄
Local $TVItemString = "" ;获取TreeView中选择的Text
Local $LsIndex ;ListBox的项目数量
Local $TVSubItemString = _GUICtrlTreeView_GetFirstItem($TreeView) ;获取TreeView中第一个项目的句柄
Local $TreeViewIndexs = _GUICtrlTreeView_GetCount($TreeView) ;获取TreeView中项目的数量
For $i = 0 To $TreeViewIndexs - 1 ;循环项目数量
If _GUICtrlTreeView_GetChecked($TreeView, $TVSubItemString) = True Then ;如果TreeView该项目的复选框被选择
$TVItemString = _GUICtrlTreeView_GetText($TreeView, $TVSubItemString) ;获取TreeView被选择的项目的文本
If _GUICtrlListBox_FindInText($ListBox, $TVItemString) = -1 Then
_GUICtrlListBox_AddString($ListBox, $TVItemString)
EndIf
Else ;如果该项目的复选框不被选择
$TVItemString = _GUICtrlTreeView_GetText($TreeView, $TVSubItemString) ;获取TreeView该项目的文本
If _GUICtrlListBox_FindInText($ListBox, $TVItemString) <> -1 Then
_GUICtrlListBox_DeleteString($ListBox, _GUICtrlListBox_FindInText($ListBox, $TVItemString)) ;删除掉存在的字符串
EndIf
EndIf
$TVSubItemString = _GUICtrlTreeView_GetNext($TreeView, $TVSubItemString) ;吧TreeView句柄移至下一个
Next
EndFunc ;==>_TreeViewToListBox