Code: Select all
DesktopIcons( Show:=-1 ) ; By SKAN for ahk/ah2 on D35D/D495 @ tiny.cc/desktopicons
{
Local hProgman := WinExist("ahk_class WorkerW", "FolderView") ? WinExist()
: WinExist("ahk_class Progman", "FolderView")
Local hShellDefView := DllCall("user32.dll\GetWindow", "ptr",hProgman, "int",5, "ptr")
Local hSysListView := DllCall("user32.dll\GetWindow", "ptr",hShellDefView, "int",5, "ptr")
If ( DllCall("user32.dll\IsWindowVisible", "ptr",hSysListView) != Show )
DllCall("user32.dll\SendMessage", "ptr",hShellDefView, "ptr",0x111, "ptr",0x7402, "ptr",0)
}
Usage: DesktopIcons(True) to show, DesktopIcons(False) to hide, DesktopIcons() to toggle the current state.