toggle Show/Hide DeskTop Icons Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
BaronKeeling
Posts: 5
Joined: 08 Nov 2020, 08:26

toggle Show/Hide DeskTop Icons

Post by BaronKeeling » 14 Nov 2020, 06:48

Code: Select all

F1::

Control, Show,, SysListView321, ahk_class Progman
Pause

Control, Hide,, SysListView321, ahk_class Progman
UnPause

return

how can i make this toggle with one button using autohotkey programing language
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Re: toggle Show/Hide DeskTop Icons  Topic is solved

Post by SKAN » 14 Nov 2020, 07:02

I would do it as follows:

Code: Select all

#NoEnv
#Warn
#SingleInstance, Force

F1::DesktopIcons()


DesktopIcons(Show:=-1, hWnd:=0) {                    ; By SKAN on D35D @ tiny.cc/desktopicons
If ! hWnd := DllCall("GetWindow", "Ptr",WinExist("ahk_class Progman"), "UInt",5, "Ptr")
     hWnd := DllCall("GetWindow", "Ptr",WinExist("ahk_class WorkerW"), "UInt",5, "Ptr")
If DllCall("IsWindowVisible", "Ptr",DllCall("GetWindow","Ptr",hWnd, "UInt",5, "Ptr")) != Show
   DllCall("SendMessage","Ptr",hWnd, "Ptr",0x111, "Ptr",0x7402, "Ptr",0)
}
Post Reply

Return to “Ask for Help (v1)”