Hide Desktop Icons Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
theimmersion
Posts: 181
Joined: 09 Jul 2016, 08:34
Location: Serbia

Hide Desktop Icons

20 Sep 2017, 19:57

CHANGED TOPIC NAME FROM IsWindowVisible issue with classic shell DUE TO THE ORIGINAL TOPIC NAME NOT HAVING ADEQUATE NAME TO THE ISSUE AT HAND


Hi everyone, been a long time i was combing through AHK forums for help but im at a point i cant figure out how to do and cant find anything relevant in the formus so i gotta ask.
I have a hide icons script im using a long time now but i recently decided and tried classic shell on windows 10 pro. I must say i like it a lot. But now the hide icons script doesnt work anymore. Im no programmer tho. So i was using this script i found long ago here on the forums and if anyone could take a look and help.

Been a long time but i think i modified the code quite a bit to make it as smaller and simpler as possible. It used to work like a few hours ago until i installed Classic Shell and been trying to figure it out til now.
Its 3 am btw. xD Yeah, once im on it, cant stop til its done.

ControlGet, HWND, Hwnd,, SysListView321, ahk_class Progman
If HWND =
ControlGet, HWND, Hwnd,, SysListView321, ahk_class WorkerW

If DllCall("IsWindowVisible", UInt,hwnd)
WinHide, ahk_id %hwnd%
Else
WinShow, ahk_id %hwnd%

Honesty, i dont even understand how it worked til now as it is. Makes no sense to me.
I dont know how it interacts this way. But i remember i modified it buy actually deleting code that wasnt needed. The way figured out what wasnt needed for it to work is by randomly deleting code and check if still working. xD I know, pro! xDDDDD
So this is what i ended up and honestly, i dont know what even ControlGet does in this instance. I assume its getting the class but what does the if do after it?
I see no sense of it comparing itself to something else. I get the gist of the rest even if i dont know how they work. That is, i dont know the ins and outs of .dll and how to check them to know what functions they support or what the UInt does etc.

I think the issue here is that its not getting any values from hwnd. Either, because it cant from the standard User32.dll because it only sees the native window class or something? I probably said something totaly wrong. xD
It doesnt read them and i dont know how to change the code to make it work.
Also very important to note, on windows 10, the desktop class is called Progman by default but after installing Classic Shell, i noticed the class changed to WorkerW. I think its what ive seen on older windows if im not mistaken. I checked the class with:

LWin & RButton::
MouseGetPos,,,win
WinGetClass,class,ahk_id %win%
MsgBox, %class% | %win%
Return

Can anyone help? Thanks! :)

SOLUTION so newcomers dont have to scroll. ^^
Show hides desktop independently from the system settings in as less code as possible.

DetectHiddenWindows, OFF ; If this is on, "class" return a blank value and thus hiding wont work.
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%
Last edited by theimmersion on 21 Oct 2017, 14:00, edited 2 times in total.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: IsWindowVisible issue with classic shell

20 Sep 2017, 23:48

theimmersion wrote:Also very important to note, on windows 10, the desktop class is called Progman by default but after installing Classic Shell, i noticed the class changed to WorkerW. I think its what ive seen on older windows if im not mistaken. I checked the class with: [...]
I also use Classic Shell on Win10, and using your code I get:

Code: Select all

---------------------------
A_Test.ahk
---------------------------
Progman | 0x10124
---------------------------
OK   
---------------------------
I believe the class WorkerW for the desktop is caused by something else.

One way is to press LWin+D before I press LWin+RMB on the desktop. Then I get: (still using Classic Shell on Win10)

Code: Select all

---------------------------
A_Test.ahk
---------------------------
WorkerW | 0x20063c
---------------------------
OK   
---------------------------
User avatar
theimmersion
Posts: 181
Joined: 09 Jul 2016, 08:34
Location: Serbia

Re: IsWindowVisible issue with classic shell  Topic is solved

21 Sep 2017, 06:53

Yeah found the issue, wasnt Classic Shell at all. Its the show the desktop button or keyboard shortcut. It switches around to WorkerW and Progman. How can i make the script work even when its on WorkerW? I thought the script checked that but i guess now.

EDIT

Ok, i familiarized myself a bit better with the code. Thanks for pointing me in the right direction Wolf_II !

Heres the new code everyone if you ever need a lightweight icon on/off checking for both Progman and WorkerW.
I renamed the return variable so its less confusing with two same named only one in caps madness. xD

The gist of this is that you can either hide or show the desktop icons via the context menu and it will be used as a default when windows starts.
It will not edit that setting. There was a code that actually changed it which annoyed me a lot. Now im working taskbar auto hide but that is independant from the system setting so it can be used as a default when system reboots.

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%
User avatar
theimmersion
Posts: 181
Joined: 09 Jul 2016, 08:34
Location: Serbia

Re: Hide Desktop Icons

21 Sep 2017, 20:35

Alright, the show desktop is still disabling the ability to hide icons, you have to press show desktop again when that happenes. I seen no reason as to why it does that. Anyone have a clue?? Its driving me nuts.

EDIT Sorry to answer myself a lot. xD
How odd is that the moment i ask, i figured it out while ive tried to figure it out for hours prior posting. Not on purpose. Hopefully others can still learn from my mistakes.
Turns out, i had DetectHiddenWindows,On for some reason. I guess, while i was testing. That way, when you press show desktop, the windows does something and hides one class and shows another or something like that. With DetectHiddenWindows,On, it will sometimes detect one of the classes like Progman while WorkerW is the current handler. I guess, once windows hides it, WinShow/WinHide cant override it? Or is creating a conflict which the hidden one drops and looses the conflict? No idea...
I wonder if other windows versions switch between two handlers on show desktop... Also what i noticed is that some programs like VLC cant work when the icons are hidden via this script. Yet, VLC hides the icons themselves. Im really interested in how VLC handles it and why it needs those classes to be shown (im assuming its rendering on them) but if so, hides the icons independantly? I didnt try to hide icons via windows to see if VLC still renders on desktop. Will do in a sec. Maybe if someone could figure it out, i could make icons hide without affecting current classes and with it, might prevent some other issues.
Yet wallpaper engine runs fine regardless if i hide or show icons which is rather nice.

EDIT So VLC still works with icons hidden or shown via windows settings (right click context menu) but hiding or showing the Progman or WorkerW class handlers hide VLC render. Im guessing that there is a layer above icons that can be rendered on? I image the desktop out of layers if im even correct, and i thought that desktop itself had only two, the background itself and icons, the rest is on top of different handlers. Am i assuming that correctly and even calling it right?

So my final question, can someone show me other ways of hiding icons? Thanks guys! xD
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Hide Desktop Icons

22 Sep 2017, 05:33

This might work for you:
[hide/show desktop icons]
AutoHotkey recording - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 37#p131637
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
theimmersion
Posts: 181
Joined: 09 Jul 2016, 08:34
Location: Serbia

Re: Hide Desktop Icons

22 Sep 2017, 08:06

Very helpful. Thank you. Will check into it, make a few different approaches. Maybe use a setting in scripts context menu to switch between desktop control modes. :superhappy:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 228 guests