IanN1990 Posted December 8, 2011 Posted December 8, 2011 (edited) Heya, I really dislike stuff on my desktop as i enjoy looking at the impressive art-work others create but alas sometimes its needed. So i was wondering is there any way to hide desktop items but show them when the desktop is clicked? I did a bit of forum searching but couldn't find anything that would work for windows 7. **Edit Right-Click Desktop --> View --> Show Desktop Icons shows/hides them, if anyone can think of a way of emulating this function or sending the variables to windows to run it?? **Edit My OS Windows 7 Professional N (64 Bit) AnswerA - JoHanatCent - Hides all desktop related things ControlHide("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]") Sleep(5000) ControlShow("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]") AnswerB - JohnOne - Hides only Icons/Folders/Files _ToggleDesktopIcons() Func _ToggleDesktopIcons() Local $hwnd = WinGetHandle("Program Manager") Local $sClass = "[CLASS:SysListView32; INSTANCE:1]" $iVis = ControlCommand($hwnd, "", $sClass, "IsVisible", "") If Not $iVis Then ControlShow($hwnd, "", $sClass) Else ControlHide($hwnd, "", $sClass) EndIf EndFunc ;==>_ToggleDesktopIcons Edited April 14, 2012 by IanN1990
JohnOne Posted December 8, 2011 Posted December 8, 2011 Did you find anything that works for win xp? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
IanN1990 Posted December 8, 2011 Author Posted December 8, 2011 I dont have XP so i would have no way of testing if it does or did work
Moderators Melba23 Posted December 8, 2011 Moderators Posted December 8, 2011 IanN1990,Take a look at Fences. I have tried it and found it works well - and it is free for personal use. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Mikeman27294 Posted December 8, 2011 Posted December 8, 2011 I guess you could use RegFromApp and attach it to explorer, then hide and then unhide the icons to see whether it is writing the settings to the registry. If so, then you could set your program to write the appropreate value to the registry, and then re-start explorer. I used this for a program I wrote earlier this year for the techies at school to hand out to the students, for getting out of high contrast because they couldnt change their theme. It pretty quick and easy to do, so good luck.
JohnOne Posted December 8, 2011 Posted December 8, 2011 (edited) Good news and Bad:The Good news is it can be done.The Bad news is I cannot remember how I did it.The Story:I was having a go, and nothing on the desktop was changing, I tried a fair few things and then gave up.So then when I hit the corner button to bring desktop to the front all the icons disappeared.The button was actually toggling the icons on and off and I was delighted, but then I startedfarting around with the code to reverse it as it seemed to be permanent.Because of that I tried a reboot to see if it was truly permanent, and it was notbut neither did the code I had left. I've tried to recreate it but it's mocking me.The Info I was working off was an article on stackoverflow, in C#Here is what I can remember from my procedure, it started off something like this...#include <SendMessage.au3> $hwnd = WinGetHandle("Program Manager") $WM_COMMAND = 0x111 ;$TOGGLEICONS = DllStructCreate("INT_PTR") $TOGGLEICONS = DllStructCreate("ptr") If @error Then MsgBox(0, 0, 1) Exit EndIf DllStructSetData($TOGGLEICONS,1,0x7402) If @error Then MsgBox(0, 0, 2) Exit EndIf _SendMessage($hwnd,$WM_COMMAND,DllStructGetPtr($TOGGLEICONS),0)and ended up something like this...#include <SendMessage.au3> _Main() Func _Main() Local Const $Off = 0, $On = 1 Opt("WinTitleMatchMode", 4) $hwnd = WinGetHandle('classname=Progman') _ToggleIcons($hWnd, $Off) ;Sleep ( 5000 ) ;_ToggleIcons($hWnd, $On) EndFunc Func _ToggleIcons($hwnd, $OnOff) Local Const $WM_SYSCOMMAND = 0x111 Local Const $toggleDesktopCommand = 0x7402 $SendMessage = _SendMessage($hWnd, $WM_SYSCOMMAND, $toggleDesktopCommand, $OnOff) ConsoleWrite($SendMessage & @LF) If @error Then MsgBox(0,"_ToggleIcons", "_SendMessage Error: " & @error) Exit EndIf EndFuncWith a number of different attempts betweenAlong the way I also tried the registry key HKCUsoftwaremicrosftwindowscurrentversionpoliciesadding the key "Explorer" and a dword value of 1 named "NoDesktop"Sorry I never twigged when the code had worked, but maybe you can get something from my misery.EDIT:The reg key works, in that it disables desktop, hiding all icons, but you need to reboot. Edited December 8, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JoHanatCent Posted December 8, 2011 Posted December 8, 2011 Does this not work? ControlHide("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]") Sleep(5000) ControlShow("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]")
JohnOne Posted December 8, 2011 Posted December 8, 2011 Yes, yes it does. Nice one. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted December 8, 2011 Posted December 8, 2011 But it totally disable the shell. Here's a modification. _ToggleDesktopIcons(0) Func _ToggleDesktopIcons($State) If $State Then ControlShow("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") Else ControlHide("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") EndIf EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted December 8, 2011 Posted December 8, 2011 So in the end, can be something like this _ToggleDesktopIcons() Func _ToggleDesktopIcons() Local $hwnd = WinGetHandle("Program Manager") Local $sClass = "[CLASS:SysListView32; INSTANCE:1]" $iVis = ControlCommand($hwnd, "", $sClass, "IsVisible", "") If Not $iVis Then ControlShow($hwnd, "", $sClass) Else ControlHide($hwnd, "", $sClass) EndIf EndFunc ;==>_ToggleDesktopIcons AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
IanN1990 Posted December 8, 2011 Author Posted December 8, 2011 (edited) Sorry for not replying sooner as i was a bit busy with uni, thanks JoHantaCent for the starting idea and to JohnOne for improving. Your code works very well and i think should be added to the example scripts as it could help other people Though i only had a few minutes to work on it, i went for while 1 sleep(500) if winactive("[Class:Progman]") Then ControlShow("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") Else ControlHide("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") EndIf WEnd So the desktop icons are hidden, until i click the desktop and then they show, which works very nicely. Thanks to everyone that took part in this topic Edited December 8, 2011 by IanN1990
IanN1990 Posted December 21, 2011 Author Posted December 21, 2011 (edited) Though i hate reopening topics there is a small problem I found the script completely stops working if i was to change my desktop wallpaper. After using the Info Tool i find Program Manager is replaced by WorkerW, any ideas on how i could hide/show this to remove/show the desktop icons ? Info >>>> Window <<<< Title: Class: WorkerW Position: -1920, 0 Size: 5760, 1080 Style: 0x96000000 ExStyle: 0x00000080 Handle: 0x000305AC >>>> Control <<<< Class: SysListView32 Instance: 1 ClassnameNN: SysListView321 Name: Advanced (Class): [CLASS:SysListView32; INSTANCE:1] ID: 1 Text: FolderView Position: 0, 0 Size: 5760, 1080 ControlClick Coords: 2321, 116 Style: 0x56003A40 ExStyle: 0x00000000 Handle: 0x00010118 >>>> Mouse <<<< Position: 401, 116 Cursor ID: 0 Color: 0x081005 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< FolderView >>>> Hidden Text <<<< Edited December 21, 2011 by IanN1990
Developers Jos Posted December 21, 2011 Developers Posted December 21, 2011 IanN1990,Take a look at Fences. I have tried it and found it works well - and it is free for personal use. M23I use this too since I use Win7 and is really simple and nice! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
IanN1990 Posted December 21, 2011 Author Posted December 21, 2011 (edited) If it turns that, that becomes the only way this idea can be put then i would look into it but i prefer finding coding solutions rather then using third-party software. Otherwise i would end up with hundreds of .exes rather then one coded exe i can understand and can tinker with For most reasons the code posted above does work, and does allow changing of wallpapers "If u right click a picture and click set a wallpaper", but for some reason if u change a wallpaper via Right click desktop --> Personalize then it changes the desktop to the WorkerW which the code cant show/hide and thus the problem happens Edited December 21, 2011 by IanN1990
JohnOne Posted December 21, 2011 Posted December 21, 2011 I just changed my desktop background via right click personalize and it remains program manager, with the code still working fine. Please explain how you are getting this workerW (which sounds like a different thrad name) exactly fron the personalize menu. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
IanN1990 Posted December 21, 2011 Author Posted December 21, 2011 I right click the desktop, click personalize, click "my theme(1)" which is a unsaved theme, then click the bottom "desktop background" which then shows available desktop backgrounds "from my picture location", i click a picture "it previews the desktop" and then i save. The desktop is now on WorkerW rather then Program Manager I have Windows 7 Proffesional N ( 64 Bit )
JohnOne Posted December 21, 2011 Posted December 21, 2011 I cannot get that here Win 7 - 32 Perhaps this workerW is there, but I doubt program manager has closed. What exactly happens when you run the code? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
IanN1990 Posted December 21, 2011 Author Posted December 21, 2011 (edited) Well my whole code is over 700 lines but the code that focuses on the desktop is here ;HideDesktop if WinExists("Personalization") Then ControlShow("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") Else if winactive("[Class:Progman]") Then $hide=0 $loop = 0 ControlShow("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") $pos1 = MouseGetPos() $loop1 = $loop1 + $num if $loop1 = 15 Then $loop1 = 0 sleep(500) $pos2 = MouseGetPos() if $pos1[0] = $pos2[0] Then if $pos1[1] = $pos2[1] Then WinActivate("Friends") ControlHide("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") EndIf EndIf EndIf Else if $hide=0 then $loop = $loop + $num if $loop = 10 Then $hide=1 ControlHide("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]") EndIf EndIf EndIf EndIf Also i have rebooted, "not running my script at all" doing the same right-click desktop and the workerW still appears If it turns out to be some weird bug with my system i made this temp patch. Checks to see if the preview window is opened "which is causing the problem", closes it and opens up the folder from which i can set desktop that way. Not perfect perhaps but still allows for the so the original code provided to work without a problerm if WinExists("Desktop Background") Then WinClose("Desktop Background") ShellExecuteWait("D:Pictures01¦ Wallpapers & Display PicturesTri-Screen Wallpapers") WinSetTrans("Tri-Screen Wallpapers", "", 0) sleep(100) WinSetTrans("Tri-Screen Wallpapers", "", 0) WinMove("Tri-Screen Wallpapers", "", 0, 0) WinSetState("Tri-Screen Wallpapers", "", @SW_MAXIMIZE) WinSetTrans("Tri-Screen Wallpapers", "", 255) EndIf Edited December 21, 2011 by IanN1990
JohnOne Posted December 21, 2011 Posted December 21, 2011 But what actually goes on, when you run just the code from post #10? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
IanN1990 Posted December 21, 2011 Author Posted December 21, 2011 (edited) if i run the code from post #10 it hides the stuff on the desktop. Running the code again shows the stuff, but if i was to change the wallpaper via right-clicking the desktop. The code no longer works Edited December 21, 2011 by IanN1990
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now