win10/win11快速隐藏/显示桌面图标快捷方式

通过一个简单的代码实现Alt+Q快捷键,可以快速隐藏和显示Windows桌面图标。只需创建一个文本文件,复制代码并改后缀为.ahk,双击运行。为了方便,可以将其放入启动文件夹,使得每次开机自动生效。
摘要由CSDN通过智能技术生成

  使用windows系统的时候,桌面有时会变得比较杂乱,想要随时随地很方便的隐藏和显示桌面图标还不是不是一件容易的事情,这里介绍了一个代码,可以很方便地设置快捷方式。
  快捷键alt+q隐藏/显示图标,代码如下:

!q::
HideOrShowDesktopIcons()
return
 
HideOrShowDesktopIcons()
{
	ControlGet, class, Hwnd,, SysListView321, ahk_class Progman
	If class =
		ControlGet, class, Hwnd,, SysListView321, ahk_class WorkerW
 
	If DllCall("IsWindowVisible", UInt,class)
		WinHide, ahk_id %class%
	Else
		WinShow, ahk_id %class%
}
;双击桌面右上角显示隐藏桌面图标
 
#Persistent
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
;~ 桌面Progman|WorkerW
GroupAdd, Desktop, ahk_class ExploreWClass
GroupAdd, Desktop, ahk_class WorkerW
WaitTime := DllCall("GetDoubleClickTime")/1000
;屏幕左上
x1:=0
y1:=0
;任务栏高度
WinGetPos,,,, h,ahk_class Shell_TrayWnd
;屏幕右下
x2:=A_ScreenWidth
y2:=A_ScreenHeight-h
OutputDebug %x2%,%y2%
#IfWinActive, ahk_group Desktop
~LButton::
KeyWait,LButton
KeyWait, LButton, d T %WaitTime%+200
If ! Errorlevel
{
	MouseGetPos,x,y
	OutputDebug %x%-%y%
	;~ if (x<x1+10 and y<y1+10 )  ;屏幕左上角10*10见方。
	;~ {	
		;~ OutputDebug 左上角
		;~ HideOrShowDesktopIcons()
	;~ }
	if (x>x2-10 and y<y1+10 )  ;屏幕右上角10*10见方。
	{	
		OutputDebug 右上角
		HideOrShowDesktopIcons()
	}
	else if (x<x1+10)
    {
		OutputDebug 左边
        ;~ Run notepad
    }
	else if (y<y1+10)
    {
		OutputDebug 上边
        ;~ Run notepad
    }
 
	else if(x>x2-10)
	{
		OutputDebug 右边
		;~ run calc
	}
	else if(y>y2-10)
	{
		OutputDebug 下边
		;~ run calc
	}
	else
	{
		OutputDebug 其它
		ToolTip %x%-%y%
		Sleep,1000
		ToolTip
	}
}
return
 
	
HideOrShowDesktopIcons()
{
	ControlGet, class, Hwnd,, SysListView321, ahk_class Progman
	If class =
		ControlGet, class, Hwnd,, SysListView321, ahk_class WorkerW
 
	If DllCall("IsWindowVisible", UInt,class)
		WinHide, ahk_id %class%
	Else
		WinShow, ahk_id %class%
}

  新建一个文本文件,将代码复制进去,再将后缀改为.ahk即可,双击文件,即可实现快捷隐藏/显示桌面图标。可以将该文件放入文件自启动文件夹中,这样可以避免每次打开电脑都要重新双击它。使用win+r键打开运行窗口,输入shell:startup,在打开的文件夹中将此文件放入其中即可。
  参考链接:链接

评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

melodic18

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值