本帖最后由 lujd0429 于 2012-9-28 14:23 编辑
本人学习AutoIt不久,用仅学会的一点皮毛做出了一个小软件,共享给大家使用!
源码+作品地址:
源码如下
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=logo.ico
#PRE_Outfile=C:\Users\LJD\Desktop\Win小箭头去除还原工具.exe
#PRE_Res_Comment=Win7小箭头去除\还原工具
#PRE_Res_Description=这是一个可以自由去除和还原Win7系统快捷方式小箭头的工具^_^
#PRE_Res_Fileversion=1.0.0.0
#PRE_Res_LegalCopyright=lujd0429(www.autoitx.com)
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstants.au3>
#include <Process.au3>
GUICREATE ( "Win7小箭头去除/还原工具" , 382 , 250 , - 1 , - 1 )
GUISETICON ( ".\logo.ico" )
GUISETBKCOLOR ( 16247543 )
$P = GUICTRLCREATEPIC ( ".\Pic.jpg" , 2 , 1 , 378 , 86 )
GUICTRLCREATEGROUP ( "" , 18 , 98 , 345 , 120 )
$BUTTON1 = GUICTRLCREATEBUTTON ( "去除小箭头" , 36 , 113 , 107 , 96 )
GUICTRLSETCURSOR ( - 1 , 0 )
$BUTTON2 = GUICTRLCREATEBUTTON ( "还原小箭头" , 238 , 113 , 107 , 96 )
GUICTRLSETCURSOR ( - 1 , 0 )
GUICTRLCREATEGROUP ( "" , - 99 , - 99 , 1 , 1 )
GUICTRLCREATELABEL ( "本软件由" , 18 , 224 , 48 , 40 )
$BUTTONTEXT = GUICTRLCREATELABEL ( "lujd0429" , 69 , 224 , 72 , 40 )
GUICTRLSETCOLOR ( - 1 , 16711680 )
GUICTRLSETCURSOR ( - 1 , 0 )
GUICTRLCREATELABEL ( "制作" , 120 , 224 , 45 , 40 )
GUICTRLCREATELABEL ( "2012年3月27日" , 283 , 224 , 99 , 40 )
GUISETSTATE ( @SW_SHOW )
$Path = "C:\Windows\Temp"
FileInstall(".\Pic.jpg",$Path&"\Pic.jpg",1)
FilesetAttrib($Path&"\Pic.jpg","+H",1)
if $p == 0 Then
GUICTRLCREATEPIC ( $Path&"\Pic.jpg" , 2 , 1 , 378 , 86 )
Endif
IF @OSARCH == "X86" THEN
LOCAL $VAR = REGREAD ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" , "29" )
ELSE
LOCAL $VAR = REGREAD ( "HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" , "29" )
ENDIF
IF ( $VAR == "" AND @ERROR ) THEN
CONTROLDISABLE ( "Win7小箭头去除/还原工具" , "还原小箭头" , "Button3" )
ELSEIF @ERROR == 0 THEN
CONTROLDISABLE ( "Win7小箭头去除/还原工具" , "去除小箭头" , "Button2" )
ENDIF
WHILE 1
$MSG = GUIGETMSG ( )
SELECT
CASE $MSG = $BUTTONTEXT
SHELLEXECUTE ( "http://www.autoitx.com/space-uid-7658831.html" )
CASE $MSG = $BUTTON1
DELETE ( )
CASE $MSG = $BUTTON2
RESET ( )
CASE $MSG = $GUI_EVENT_CLOSE
$POS = WINGETPOS ( "Win7小箭头去除/还原工具" , "" )
WINMOVE ( "Win7小箭头去除/还原工具" , "" , 1490 , $POS [ 1 ] , $POS [ 2 ] , $POS [ 3 ] , 3 )
FileDelete($Path&"\Pic.jpg")
EXIT
ENDSELECT
WEND
FUNC DELETE ( )
IF @OSARCH == "X86" THEN
FILEINSTALL ( ".\Empty.ico" , "C:\Windows\Empty.ico" )
REGWRITE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" , "29" , "REG_SZ" , "C:\Windows\Empty.ico,0" )
ELSE
FILEINSTALL ( ".\Empty.ico" , "C:\Windows\Empty.ico" )
REGWRITE ( "HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" , "29" , "REG_SZ" , "C:\Windows\Empty.ico,0" )
ENDIF
IF MSGBOX ( 0 , "提示" , "删除小箭头成功!" ) = 1 THEN
PROCESSCLOSE ( "explorer.exe" )
Sleep(90)
IF NOT ( PROCESSEXISTS ( "explorer.exe" ) == 0 ) THEN
_RunDos("taskkill /f /im explorer.exe") ; 此处用于检测并达到指定结束Explorer。exe的目的
_RunDos("start explorer.exe")
Else
RUN ( @SYSTEMDIR & "\explorer.exe" )
Endif
IF PROCESSEXISTS ( "explorer.exe" ) == 0 THEN
_RunDos("start explorer.exe")
ENDIF
ENDIF
CONTROLENABLE ( "Win7小箭头去除/还原工具" , "还原小箭头" , "Button3" )
CONTROLDISABLE ( "Win7小箭头去除/还原工具" , "去除小箭头" , "Button2" )
ENDFUNC
FUNC RESET ( )
FILEDELETE ( "C:\Windows\Empty.ico" )
IF @OSARCH == "X86" THEN
REGDELETE ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" )
ELSE
REGDELETE ( "HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" )
ENDIF
IF MSGBOX ( 0 , "提示" , "恢复小箭头成功!" ) = 1 THEN
PROCESSCLOSE ( "explorer.exe" )
IF NOT ( PROCESSEXISTS ( "explorer.exe" ) == 0 ) THEN
_RunDos("taskkill /f /im explorer.exe") ; 此处用于检测并达到指定结束Explorer。exe的目的
_RunDos("start explorer.exe")
Else
RUN ( @SYSTEMDIR & "\explorer.exe" )
Endif
IF PROCESSEXISTS ( "explorer.exe" ) == 0 THEN
_RunDos("start explorer.exe")
ENDIF
ENDIF
CONTROLENABLE ( "Win7小箭头去除/还原工具" , "去除小箭头" , "Button2" )
CONTROLDISABLE ( "Win7小箭头去除/还原工具" , "还原小箭头" , "Button3" )
ENDFUNC
|