#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <GuiImageList.au3>
#include <GuiButton.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 360, 209, 152)
;------------------------------------------------------------------
$Group1 = GUICtrlCreateGroup("", 4, -5, 245, 73)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("", 250, -5, 245, 73)
GUICtrlCreateGroup("", -99, -99, 1, 1)
;------------------------------------------------------------------
;------------------------------------------------------------------
$menu_A = GUICtrlCreateMenu("菜单1[&O]");创建一个菜单控件
GUICtrlCreateMenu("菜单2[&T]");创建一个菜单控件
;-------------------------------------------------------------------
Local $button1
$button1 = GUICtrlCreateButton("刷新", 10, 6, 50, 55, $BS_FLAT)
$hImage1 = _GUIImageList_Create(30, 30, 5, 1, 0)
_GUIImageList_AddIcon($hImage1, "c:\windows\regedit.exe", 0, True)
_GUICtrlButton_SetImageList($button1, $hImage1, 2)
$Button2 = GUICtrlCreateButton("删除", 70, 6, 50, 55, $BS_FLAT)
$hImage2 = _GUIImageList_Create(30, 30, 5, 1, 0)
_GUIImageList_AddIcon($hImage2, "shell32.dll", 131, True)
_GUICtrlButton_SetImageList($Button2, $hImage2, 2)
$Button3 = GUICtrlCreateButton("关于", 130, 6, 50, 55, $BS_FLAT)
$hImage3 = _GUIImageList_Create(30, 30, 5, 1, 0)
_GUIImageList_AddIcon($hImage3, "shell32.dll", 221, True)
_GUICtrlButton_SetImageList($Button3, $hImage3, 2)
$Button4 = GUICtrlCreateButton("退出", 190, 6, 50, 55, $BS_FLAT)
$hImage4 = _GUIImageList_Create(30, 30, 5, 1, 0)
_GUIImageList_AddIcon($hImage4, "shell32.dll", 219, True)
_GUICtrlButton_SetImageList($Button4, $hImage4, 2)
;-------------------------------------------------------------------
$TreeView1 = GUICtrlCreateTreeView(8, 72, 169, 265, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$everyone = GUICtrlCreateTreeViewItem("所有启动项", $TreeView1)
$userrun = GUICtrlCreateTreeViewItem("HKEY_CURRENT_USER", $everyone)
$run1 = GUICtrlCreateTreeViewItem("Run", $userrun)
$runone = GUICtrlCreateTreeViewItem("RunOne", $userrun)
$machinerun = GUICtrlCreateTreeViewItem("HKEY_LOCAL_MACHINE", $everyone)
$run2 = GUICtrlCreateTreeViewItem("Run", $machinerun)
$runone1 = GUICtrlCreateTreeViewItem("RunOne", $machinerun)
$RunOnceEx = GUICtrlCreateTreeViewItem("RunOnceEx", $machinerun)
$RunServices = GUICtrlCreateTreeViewItem("RunServices", $machinerun)
$RunServicesEX = GUICtrlCreateTreeViewItem("RunServicesEX", $machinerun)
GUICtrlSetState($everyone, $GUI_EXPAND)
GUICtrlSetState($userrun, $GUI_EXPAND)
GUICtrlSetState($machinerun, $GUI_EXPAND)
;------------------------------------------------------------------
GUICtrlSetImage($TreeView1, "regedit.exe", 0);设置指定控件的位图或图标
$ListView1 = GUICtrlCreateListView("名称 |路径|信息 ", 184, 72, 433, 265)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 250);设置“路径”显示长度
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
up()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $everyone
del()
up()
Case $userrun
del()
Run1()
Case $run1
del()
Run1()
Case $runone
del()
RunOne()
Case $machinerun
del()
Run2()
RunOne1()
RunOnceEx()
RunServices()
RunServicesEX()
Case $run2
del()
Run2()
Case $runone1
del()
RunOne1()
Case $RunOnceEx
del()
RunOnceEx()
Case $RunServices
del()
RunServices()
Case $RunServicesEX
del()
RunServicesEX()
Case $button1
GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
up()
Case $Button2
dir()
Case $Button3
MsgBox(64, '关于', "BY 内蒙赤峰DJ", 5)
Case $Button4
Exit
EndSwitch
WEnd
Func up()
Run1()
RunOne()
Run2()
RunOne1()
RunOnceEx()
RunServices()
RunServicesEX()
EndFunc ;==>up
;----------------------------------------------------------------------------------------------HKEY_CURRENT_USER
Func Run1()
$Texts = "RegUserRun"
For $i = 1 To 100
$var = RegEnumVal("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", $i)
If @error <> 0 Then ExitLoop
$var2 = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", $var)
GUICtrlCreateListViewItem("" & $var & "|" & $var2 & "|" & $Texts & "", $ListView1)
Next
EndFunc ;==>Run1
Func RunOne()
$Texts = "RegUserRunOne"
For $i = 1 To 100
$var = RegEnumVal("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOne", $i)
If @error <> 0 Then ExitLoop
$var2 = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOne", $var)
GUICtrlCreateListViewItem("" & $var & "|" & $var2 & "|" & $Texts & "", $ListView1)
Next
EndFunc ;==>RunOne
;-------------------------------------------------------------------------------------------------HKEY_LOCAL_MACHINE
Func Run2()
$Texts = "RegMachineRun"
For $i = 1 To 100
$var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i)
If @error <> 0 Then ExitLoop
$var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $var)
GUICtrlCreateListViewItem("" & $var & "|" & $var2 & "|" & $Texts & "", $ListView1)
Next
EndFunc ;==>Run2
Func RunOne1()
$Texts = "RegMachineRunOne"
For $i = 1 To 100
$var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOne", $i)
If @error <> 0 Then ExitLoop
$var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOne", $var)
GUICtrlCreateListViewItem("" & $var & "|" & $var2 & "|" & $Texts & "", $ListView1)
Next
EndFunc ;==>RunOne1
Func RunOnceEx()
$Texts = "RegMachineRunOnceEx"
For $i = 1 To 100
$var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx", $i)
If @error <> 0 Then ExitLoop
$var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx", $var)
GUICtrlCreateListViewItem("" & $var & "|" & $var2 & "|" & $Texts & "", $ListView1)
Next
EndFunc ;==>RunOnceEx
Func RunServices()
$Texts = "RegMachineRunServices"
For $i = 1 To 100
$var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices", $i)
If @error <> 0 Then ExitLoop
$var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices", $var)
GUICtrlCreateListViewItem("" & $var & "|" & $var2 & "|" & $Texts & "", $ListView1)
Next
EndFunc ;==>RunServices
Func RunServicesEX()
$Texts = "RegMachineRunServicesEX"
For $i = 1 To 100
$var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesEX", $i)
If @error <> 0 Then ExitLoop
$var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesEX", $var)
GUICtrlCreateListViewItem("" & $var & "|" & $var2 & "|" & $Texts & "", $ListView1)
Next
EndFunc ;==>RunServicesEX
;-------------------------------------------------------------------------------------------------------
Func dir()
$log = _GUICtrlListView_GetItemCount($ListView1);获取列表视图控件的项目数
$CURRENT = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion"
$LOCAL = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"
If MsgBox(4, '提示', '您确定要删除此项目?') = 6 Then
For $i = 0 To $log
$Text = _GUICtrlListView_GetItemTextString($ListView1, $i);获取全部列表视图中的项目
$String = StringSplit($Text, "|")
If _GUICtrlListView_GetItemChecked($ListView1, $i) = True Then
If $String[3] = "RegUserRun" Then RegDelete($CURRENT & "Run", $String[1])
If $String[3] = "RegUserRunOne" Then RegDelete($CURRENT & "RunOnce", $String[1])
If $String[3] = "RegMachineRun" Then RegDelete($LOCAL & "Run", $String[1])
If $String[3] = "RegMachineRunOne" Then RegDelete($LOCAL & "RunOnce", $String[1])
If $String[3] = "RegMachineRunOnceEx" Then RegDelete($LOCAL & "RunOnceEx", $String[1])
If $String[3] = "RegMachineRunServices" Then RegDelete($LOCAL & "RunServices", $String[1])
If $String[3] = "RegMachineRunServicesEX" Then RegDelete($LOCAL & "RunServicesEX", $String[1])
Else
EndIf
Next
MsgBox(64, '提示', '删除成功')
Else
EndIf
del()
up()
EndFunc ;==>dir
Func del()
GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
EndFunc ;==>del