Page 1 of 1
Updated : Hide / Show Desktop Icons Programmatic (Windows)
Posted: Tue Jun 08, 2010 7:22 am
by RASHAD
It is very small tip but it can be useful for somebody
Code: Select all
hwnd = OpenWindow(0, 0, 0, 300, 300, "Hide \ Show Desktop Icons", #PB_Window_Invisible)
ShowWindow_(GetWindow_(hwnd,#GW_HWNDLAST), #SW_HIDE) ;Hide Desktop Icons
;ShowWindow_(GetWindow_(hwnd,#GW_HWNDLAST), #SW_SHOW) ;Show Desktop Icons
Repeat
Delay(10)
Q = 1
Until Q = 1
Have fun
Re: Hide / Show Desktop Icons Programatic (Windows)
Posted: Tue Jun 08, 2010 1:42 pm
by yrreti
Thanks RASHAD
Your small example is big in usefulness. My desktop is cluttered with
icons that I often use, but sometimes it's nice to make them disappear.
Your code works perfectly.
Thanks much.
Re: Hide / Show Desktop Icons Programatic (Windows)
Posted: Wed Jun 09, 2010 2:44 pm
by Kwai chang caine
Thanks RASHAD
It can be usefull.... and also funny for make a joke, at my colleague of job for exampler
Kcc always ready to laugh

Re: Hide / Show Desktop Icons Programatic (Windows)
Posted: Wed Jun 09, 2010 4:29 pm
by RASHAD
@yrreti
@KCC
You are welcome.
Re: Hide / Show Desktop Icons Programatic (Windows)
Posted: Wed Jul 07, 2010 8:42 am
by Morty
Interesting code ... thanx.
But on my system i get a "little" bug.
If I press [window-key]+[d] (which I always do to get my desktop) the icons still are visible.
If i minimize all windows ... all works fine
Is there a way to prevent this behavior?
My system: Win 7 Professional (32 bit)
Morty
Re: Hide / Show Desktop Icons Programatic (Windows)
Posted: Wed Jul 07, 2010 1:49 pm
by RASHAD
@Morty Hi and thank you
Sorry the only way I know To disable Windows Start+X shortcuts is by modifing the registry
then logoff / logon To refresh the registry (specially For windows 7)
The old method by end the explorer task and start new one is not working any more
I prefer the first by using scancode Map
To enable the shortcut again delete the key from the registry And refresh it again
But I will keep digging may be there is some other way to do it
1)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,00,00,5B,E0,00,00,5C,E0,00,00,00,00
2)
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoWinKeys"=dword:00000001
Re: Hide / Show Desktop Icons Programatic (Windows)
Posted: Wed Jul 07, 2010 3:05 pm
by RASHAD
@Morty Hi again
Next is the same code with disabling the Windows Start Key Programmatic
It is as you requested
If you ask me and do not like it
But it is up to you
Tested with windows 7 only
Code: Select all
hwnd = OpenWindow(0, 0, 0, 300, 300, "Hide \ Show Desktop Icons", #PB_Window_Invisible)
ShowWindow_(GetWindow_(hwnd,#GW_HWNDLAST), #SW_HIDE) ;Hide Desktop Icons
;ShowWindow_(GetWindow_(hwnd,#GW_HWNDLAST), #SW_SHOW) ;Show Desktop Icons
Repeat
Delay(10)
Q = 1
Until Q = 1
Structure KBDLLHOOKSTRUCT
vkCode.i
scanCode.i
EndStructure
Global Hook.i, Dim Key.s(256)
Procedure KeyboardHook(nCode, wParam,*k.KBDLLHOOKSTRUCT)
If nCode < 0
ProcedureReturn CallNextHookEx_(hook, nCode, wParam,*k.KBDLLHOOKSTRUCT)
EndIf
If (wParam=#WM_KEYDOWN And EventwParam() = 91) Or (wParam=#WM_KEYUP And EventwParam() = 91)
ProcedureReturn 1
EndIf
ProcedureReturn CallNextHookEx_(hook, nCode, wParam,*k.KBDLLHOOKSTRUCT)
EndProcedure
OpenWindow(0, -200, 0, 0, 0, "", #PB_Window_SystemMenu)
hook=SetWindowsHookEx_(#WH_KEYBOARD_LL, @KeyboardHook(), GetModuleHandle_(0), 0)
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_CloseWindow: Break
EndSelect
ForEver
UnhookWindowsHookEx_(hook)
End
Re: Updated : Hide / Show Desktop Icons Programatic (Windows
Posted: Thu Jul 08, 2010 11:00 am
by Morty
@RASHAD: Hi
Thanks for your help, but a keyboard hook is not what I'm searched for.
I don't know if I exlpained it wrong or if I misunderstood your answer
The question is: Is there a way to hide the desktop icons in an other way, so that i
can use [window-key]+[d] to switch to the desktop ?
Greatz, Morty
Re: Updated : Hide / Show Desktop Icons Programatic (Windows
Posted: Tue Aug 03, 2010 5:02 pm
by ar-s
Thanks for this usefull code !
Re: Updated : Hide / Show Desktop Icons Programmatic (Window
Posted: Wed Dec 01, 2010 10:43 am
by Alireza
Re: Updated : Hide / Show Desktop Icons Programmatic (Windows)
Posted: Mon May 09, 2022 8:54 pm
by IdeasVacuum
RASHAD wrote: Tue Jun 08, 2010 7:22 am
It is very small tip but it can be useful for somebody
Hi Rashad - it works well, but if I run the code via a button on my program, the program window is also hidden........
Your other code works perfect:
Code: Select all
#ToggleDesktopico = $7402
hWnd = GetWindow_(FindWindow_("Progman", "Program Manager"), #GW_CHILD)
SendMessage_(hWnd, #WM_COMMAND, #ToggleDesktopico, 0)