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

Posted bluepointlilac

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了移除任务栏右端"显示桌面"按钮-AutoIt相关的知识,希望对你有一定的参考价值。

#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") & "BluePointLilacRemoveShowDesktopButton"
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_USERSoftwareMicrosoftWindowsCurrentVersionRun", "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_USERSoftwareMicrosoftWindowsCurrentVersionRun", "RemoveShowDesktopButton", "REG_SZ", @ScriptFullPath)
					TrayItemSetState($iRun, $TRAY_CHECKED)
					TrayItemSetState($iBack, $TRAY_ENABLE)
				ElseIf TrayItemGetState($iRun)=65 Then
					RegDelete("HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun", "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_USERSoftwareMicrosoftWindowsCurrentVersionRun", "RemoveShowDesktopButton", "REG_SZ", $iPath & "RemoveShowDesktopButton.exe")
				ElseIf TrayItemGetState($iBack)=65 Then
					RegWrite("HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun", "RemoveShowDesktopButton", "REG_SZ", @ScriptFullPath)
					TrayItemSetState($iBack, $TRAY_UNCHECKED)
					FileDelete($iPath & "RemoveShowDesktopButton.exe")
				EndIf
			Case $iExit
				ExitLoop
		EndSwitch
	WEnd
EndFunc

  

以上是关于移除任务栏右端"显示桌面"按钮-AutoIt的主要内容,如果未能解决你的问题,请参考以下文章

WPF中expander 展开按钮如何设置位于右边,且没有边框

ubuntu进入桌面后,任务栏显示不了

怎样修改自己创建桌面快捷的图标

ubuntu重启后桌面啥都没有了

win11任务栏右键没有任务管理器的解决办法 - 添加win11任务栏右键功能

电脑输入密码后黑屏打开任务管理器也不行?