Sign in to follow this  
Followers 0
ken82m

Hide Desktop Icons (Win7 x64)

8 posts in this topic

I've found plenty of methods to toggle desktop icon visibility do this on the au3 forum and loads of them on google.

But nothing I've tried has worked except right clicking on the desktop>view>show desktop icons.

I'd like to list what i've tried for you but the list is endless, however I tried every script that came.

But here are the last three autoit solutions I've found.

Thanks,

Kenny

WinSetState("Program Manager", "", @SW_HIDE)

#include <GUIListView.au3>
$h = WinGetHandle("[CLASS:Progman]")
$hwnd = ControlGetHandle($h,"","SysListView321")
_GUICtrlListView_SetView($hwnd,3)

MsgBox(0, "Warning", "Now we hide desktop icons")
_ShowHideIcons(@SW_HIDE)

MsgBox(0, "Warning", "Now we show desktop icons")
_ShowHideIcons(@SW_SHOW)

Func _ShowHideIcons($sState)
    Local $hParent = WinGetHandle("Program Manager")
    Local $hListView = ControlGetHandle($hParent, "", "SysListView321")

    WinSetState($hListView, "", $sState)
EndFunc

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

DllCall('user32.dll', 'lresult', 'SendMessage', 'hwnd', ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SHELLDLL_DefView]'), 'uint', 0x0111, 'wparam', 29698, 'lparam', 0)
Sleep(2000)
DllCall('user32.dll', 'lresult', 'SendMessage', 'hwnd', ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SHELLDLL_DefView]'), 'uint', 0x0111, 'wparam', 29698, 'lparam', 0)

Edited by Yashied

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Another one...Posted Image

#Include <WinAPI.au3>

_ShowDesktopIcons ( 0 ) ; Hide
Sleep ( 3000 )
_ShowDesktopIcons ( 1 ) ; Show


Func _ShowDesktopIcons ( $_Show )
    _WinAPI_PostMessage ( ControlGetHandle ( WinGetHandle ( '[CLASS:Progman]' ), '', '[CLASSNN:SHELLDLL_DefView1]' ), 0x00111, 0x7402, $_Show )
EndFunc
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

cool, thanks ;)

appreciate it.

-Kenny


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites

Another one...Posted Image

#Include <WinAPI.au3>

_ShowDesktopIcons ( 0 ) ; Hide
Sleep ( 3000 )
_ShowDesktopIcons ( 1 ) ; Show


Func _ShowDesktopIcons ( $_Show )
    _WinAPI_PostMessage ( ControlGetHandle ( WinGetHandle ( '[CLASS:Progman]' ), '', '[CLASSNN:SHELLDLL_DefView1]' ), 0x00111, 0x7402, $_Show )
EndFunc

This is wrong. What is $ _Show? This parameter is not used by WM_COMMAND (0x0111) and must be set to 0.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

In addition.

_ToggleDesktopIcon()
ConsoleWrite('Show desktop icons: ' & _IsDesktopIconShow() & @CR)
Sleep(2000)
_ToggleDesktopIcon()
ConsoleWrite('Show desktop icons: ' & _IsDesktopIconShow() & @CR)

Func _IsDesktopIconShow()
    Return (BitAND(WinGetState(ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SysListView32]')), 2) = 2)
EndFunc   ;==>_IsDesktopIconShow

Func _ToggleDesktopIcon()
    DllCall('user32.dll', 'lresult', 'SendMessage', 'hwnd', ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SHELLDLL_DefView]'), 'uint', 0x0111, 'wparam', 29698, 'lparam', 0)
EndFunc   ;==>_IsDesktopIconShow
Edited by Yashied

Share this post


Link to post
Share on other sites

In addition.

_ToggleDesktopIcon()
ConsoleWrite('Show desktop icons: ' & _IsDesktopIconShow() & @CR)
Sleep(2000)
_ToggleDesktopIcon()
ConsoleWrite('Show desktop icons: ' & _IsDesktopIconShow() & @CR)

Func _IsDesktopIconShow()
    Return (BitAND(WinGetState(ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SysListView32]')), 2) = 2)
EndFunc   ;==>_IsDesktopIconShow

Func _ToggleDesktopIcon()
    DllCall('user32.dll', 'lresult', 'SendMessage', 'hwnd', ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SHELLDLL_DefView]'), 'uint', 0x0111, 'wparam', 29698, 'lparam', 0)
EndFunc   ;==>_IsDesktopIconShow

The above method plus a new others I've found on the forums work great in Windows XP but I can't get any of them to work on Windows 7. Whether with run as admin or not they don't work. Any ideas?

Share this post


Link to post
Share on other sites

DllCall('user32.dll', 'lresult', 'SendMessage', 'hwnd', ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SHELLDLL_DefView]'), 'uint', 0x0111, 'wparam', 29698, 'lparam', 0)Sleep(2000)DllCall('user32.dll', 'lresult', 'SendMessage', 'hwnd', ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SHELLDLL_DefView]'), 'uint', 0x0111, 'wparam', 29698, 'lparam', 0)

In addition.

_ToggleDesktopIcon()ConsoleWrite('Show desktop icons: ' & _IsDesktopIconShow() & @CR)Sleep(2000)_ToggleDesktopIcon()ConsoleWrite('Show desktop icons: ' & _IsDesktopIconShow() & @CR)Func _IsDesktopIconShow()  Return (BitAND(WinGetState(ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SysListView32]')), 2) = 2)EndFunc   ;==>_IsDesktopIconShowFunc _ToggleDesktopIcon()  DllCall('user32.dll', 'lresult', 'SendMessage', 'hwnd', ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SHELLDLL_DefView]'), 'uint', 0x0111, 'wparam', 29698, 'lparam', 0)EndFunc   ;==>_IsDesktopIconShow

This works fine under W7 x64 but I have noticed that the script must run once after Windows has been restarted. So the script works only the second time. Does anyone have a solution to it?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0