码迷,mamicode.com
首页 > 其他好文 > 详细

移除任务栏右端"显示桌面"按钮-AutoIt

时间:2019-10-19 00:26:40      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:ant   eth   创建   pre   removes   pil   red   appdata   UNC   

#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=蓝点lilac.ico
#PRE_Outfile=RemoveShowDesktopButton_x32.exe
#PRE_Outfile_x64=RemoveShowDesktopButton_x64.exe
#PRE_Compression=4
#PRE_Compile_Both=y
#PRE_Res_Comment=RemoveShowDesktopButton
#PRE_Res_Description=移除显示桌面按钮
#PRE_Res_Fileversion=1
#PRE_Res_LegalCopyright=copyright?2019 蓝点lilac
#PRE_Res_requestedExecutionLevel=None
#PRE_Res_Field=LegalTrademarks|蓝点lilac
#PRE_Res_Field=CompanyName|蓝点lilac
#Obfuscator_Parameters=/cs=1 /cn=1 /cf=1 /cv=1 /sf=1 /sv=1 /sci=1
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****

$g_szVersion = "RemoveShowDesktopButton"
If WinExists($g_szVersion) Then Exit
AutoItWinSetTitle($g_szVersion)

#include <Constants.au3>
Opt("TrayMenuMode", 3)

$hwnd = WinGetHandle("[CLASS:Shell_TrayWnd]", "")
Local $iPath = EnvGet("APPDATA") & "\BluePointLilac\RemoveShowDesktopButton\"
If @ScriptFullPath =$iPath & "RemoveShowDesktopButton.exe" Then 
	ControlHide($hwnd, "", "TrayShowDesktopButtonWClass1")
	TraySetState(1)
	TraySetState(2)
	Exit
EndIf

Example()
Func Example()	
	Local $iRunMenu = TrayCreateMenu("启动项")
	Local $iRun = TrayCreateItem("开机自启动",$iRunMenu)
	TrayCreateItem("",$iRunMenu)
	Local $iBack = TrayCreateItem("启动后退出",$iRunMenu)
	TrayCreateItem("")
	Local $iHide = TrayCreateItem("隐藏按钮")
	TrayCreateItem("")
	Local $iShow = TrayCreateItem("显示按钮")
	TrayCreateItem("")
	Local $iExit = TrayCreateItem("退出")
	
	TraySetState(1) ; Show the tray menu.
	TraySetToolTip("移除显示桌面按钮" & Chr(10) & "作者:蓝点lilac")
	
	Local $iBoot = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "RemoveShowDesktopButton")

	If FileExists($iBoot) Then 
		TrayItemSetState($iRun, $TRAY_CHECKED)
		TrayItemSetState($iBack,$TRAY_ENABLE)
		If $iBoot =$iPath & "RemoveShowDesktopButton.exe" Then 
			TrayItemSetState($iBack, $TRAY_CHECKED)
		Else
			TrayItemSetState($iBack, $TRAY_UNCHECKED)
		EndIf
	Else
		TrayItemSetState($iRun, $TRAY_UNCHECKED)
		TrayItemSetState($iBack,$TRAY_DISABLE)
	EndIf
	
	TraySetClick(8) ; Show the tray menu when the mouse if hovered over the tray icon.
	While 1
		Switch TrayGetMsg()
			Case $iHide
				ControlHide($hwnd, "", "TrayShowDesktopButtonWClass1")
				TraySetState(2)
				TraySetState(1)
			Case $iShow	
				ControlShow($hwnd, "", "TrayShowDesktopButtonWClass1")
				TraySetState(2)
				TraySetState(1)
			Case $iRun
				If TrayItemGetState($iRun)=68 Then
					RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "RemoveShowDesktopButton", "REG_SZ", @ScriptFullPath)
					TrayItemSetState($iRun, $TRAY_CHECKED)
					TrayItemSetState($iBack, $TRAY_ENABLE)
				ElseIf TrayItemGetState($iRun)=65 Then
					RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "RemoveShowDesktopButton")
					TrayItemSetState($iRun, $TRAY_UNCHECKED)
					TrayItemSetState($iBack, $TRAY_DISABLE)
					TrayItemSetState($iBack, $TRAY_UNCHECKED)
				EndIf
				
			Case $iBack	
				If TrayItemGetState($iBack)=68 Then
					TrayItemSetState($iBack, $TRAY_CHECKED)
					FileCopy(@ScriptFullPath, $iPath, 9)
					FileMove($iPath & @ScriptName,$iPath & "RemoveShowDesktopButton.exe",1)
					RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "RemoveShowDesktopButton", "REG_SZ", $iPath & "RemoveShowDesktopButton.exe")
				ElseIf TrayItemGetState($iBack)=65 Then
					RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "RemoveShowDesktopButton", "REG_SZ", @ScriptFullPath)
					TrayItemSetState($iBack, $TRAY_UNCHECKED)
					FileDelete($iPath & "RemoveShowDesktopButton.exe")
				EndIf
			Case $iExit
				ExitLoop
		EndSwitch
	WEnd
EndFunc

  

移除任务栏右端"显示桌面"按钮-AutoIt

标签:ant   eth   创建   pre   removes   pil   red   appdata   UNC   

原文地址:https://www.cnblogs.com/BluePointLilac/p/11701158.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!