梦想吧技术论坛's Archiver

似水年华 发表于 2007-4-22 07:07 PM

AU3-简单启动项编辑工具

#NoTrayIcon
#include <GUIConstants.au3>
$main=GUICreate("启动项查看",370,310)
Local $ListView1
$button1=GUICtrlCreateButton("删除启动项",20,270,80,30)
$button2=GUICtrlCreateButton("添加启动项",140,270,80,30)
$button3=GUICtrlCreateButton("刷新启动项",260,270,80,30)

GUICtrlCreateLabel("添加键名:",22,220,80,15)
GUICtrlSetColor(-1,0xff0033)
$input1=GUICtrlCreateInput("",82,217,255,20)
GUICtrlCreateLabel("添加键值:",22,245,80,15)
GUICtrlSetColor(-1,0xff0033)
$input2=GUICtrlCreateInput("",82,242,255,20)
$listview1=gui()

GUISetState (@SW_SHOW,"启动项查看")
while 1
   $msg = GuiGetMsg ()
   if $msg=$button1 then
   call("kill")
endif
if $msg=$button2 Then
   $input11=GUICtrlRead($input1)
   $input22=GUICtrlRead($input2)
   if $input11="" or $input22="" Then
msgbox("32","提示","键名或键值不能为空!!")
Else
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\run",$input11,"REG_SZ",$input22)
     guictrlsetdata($input1,"")
guictrlsetdata($input2,"")
call("gui")
endif
   endif
if $msg=$button3 Then
   call("gui")
endif
if   $msg = $GUI_EVENT_CLOSE Then
Exit
EndIf
WEnd


func gui()
if $ListView1 then GUICtrlDelete($ListView1)
$ListView1 = GUICtrlCreateListView("序列号|启动项值            |完整执行路径                       ", 10, 10, 350,200)
$i=1
while 1
$r=RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$i)
$r2=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$r)
if $r2 <> "" or $r="" Then
   $i=$i+1
Else
   exitloop
EndIf
GUICtrlCreateListViewItem("      "&$i-1&"|"&$r&"|"&$r2,$listview1)
WEnd

$p=1
while 1
$w=RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonce",$p)
$w2=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonce",$w)
if $w2 <> "" or $w="" Then
   $p=$p+1
Else
   exitloop
EndIf
GUICtrlCreateListViewItem("      "&$p-1+$i-1&"|"&$w&"|"&$w2,$listview1)
WEnd


$s=1
while 1
$e=RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx",$s)
$e2=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx",$e)
if $e2 <> "" or $e="" Then
   $s=$s+1
Else
   exitloop
EndIf
GUICtrlCreateListViewItem("      "&$s-1+$i-1+$p-1&"|"&$e&"|"&$e2,$listview1)
WEnd

$u=1
while 1
$uy=RegEnumVal("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run",$u)
$uy2=RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run",$uy)
if $uy2 <> "" or $uy="" Then
   $u=$u+1
Else
   exitloop
EndIf
GUICtrlCreateListViewItem("      "&$s-1+$i-1+$p-1+$u-1&"|"&$uy&"|"&$uy2,$listview1)
WEnd

$l=1
while 1
$ur=RegEnumVal("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce",$l)
$ur2=RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce",$ur)
if $ur2 <> "" or $ur="" Then
   $l=$l+1
Else
   exitloop
EndIf
GUICtrlCreateListViewItem("      "&$s-1+$i-1+$p-1+$u-1+$l-1&"|"&$ur&"|"&$ur2,$listview1)
WEnd

return $ListView1
EndFunc


func kill()
$read0=GUICtrlRead(GUICtrlRead($listview1))
if $read0=0 Then
else
$read=StringSplit($read0,"|")
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$read[2])
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonce",$read[2])
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx",$read[2])
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run",$read[2])
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce",$read[2])
endif
Return gui()
EndFunc

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.