Hide or Show Desktop

  • From: "Registry Answers" <regtips@xxxxxxxxxx>
  • To: "Registry Answers" <regtips@xxxxxxxxxxxxx>
  • Date: Fri, 2 Apr 2004 08:37:47 -0500

Registry Answers 
April 2, 2004 - Issue 6

Hide or Show Desktop Icons
(applies to all versions of Windows from 95 to XP)

Question: I  have problem with my 8-year-old niece.  She usually adds  
unnecessary icons on my desktop which makes my desktop a real mess. Is
there some way I can disable my desktop (but not the taskbar) to make it not 
possible for her to add icons or mess with mine?  System -  Windows XP.

Answer: In XP,  the simplest way to show or hide desktop icons is by right 
clicking the Desktop and choosing "Arrange Icons by" and then unchecking
Display Desktop icons.  Of course, this is a very lame method, as anyone can 
just right click the Desktop and check the option to show icons again. 
A more secure way, for such a situation, would be to use the registry, where we 
can make the desktop icons invisible, as well as disable the desktop right 
click 
menu to prevent her from choosing ANY options it contains. 

Here's how:

Click Start>Run, type regedit and go to this key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

Note - if the Explorer key does not exist, you will have to create it.  To do 
that, right click the Policies key
and create a new subkey and name it Explorer.

In the right hand pane for the Explorer key, right click a blank area and 
choose New>DWORD value.
Name the value: NoDesktop  
Double click it and enter 1 as the data value.

Exit the registry.  You will have to log off and log in again for the change to 
take effect.
Your desktop icons will now be invisible and right clicking to view the context 
menu to show them again will not be possible.

However, this is not a very convenient method, if you think about it. You need 
to enter the registry and manually make the change each time you need to enable 
or 
disable the desktop. To make it more convenient, wecan make a couple of simple 
reg files - one to enable and one to disable - that you would just have to 
double click to change the registry value to show or hide the desktop.

To create the disable  file, copy and paste the code below into a notepad 
document, save, and then rename the document with a .reg extension. 
ie HideDesk.reg

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoDesktop"=dword:00000001

To create the enable file to show the icons again, copy and paste this into a 
notepad document, save, and then rename the document with a .reg extension.
ie ShowDesk.reg

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoDesktop"=dword:00000000

You now have two files you can just double click to either show or hide the 
desktop icons.  Obviously, you will have to place the files in some other 
directory,
other than on the desktop, to be able to see and use them after the desktop 
icons are all made invisible.
Tip - If you place them in your Windows or System directory, you will be able 
to execute them via the Run box by just entering the name of the file.

But here again, there remains another inconvenience. You must manually log off 
and log on again (or reboot) to make the changes take effect.

One way to get around that is by creating a single vbs file to do the entire 
job (hide OR show the desktop icons, and automatically log you off and on again 
after the change is made)

I created two here - one for Windows 98/Me(which can be easily edited for 
Windows 95) and one for Windows 2000/XP. Both these files will show or hide the 
desktop like a toggle switch and then log you off and on again.

Instructions:

1.First, make sure you manually create the NoDesktop dword value in the 
registry for this to work(the script looks for the value and if it doesn't 
exist, an error will result) 

2.Copy and paste the appropriate script for your system into a notepad 
document, save it, and then rename  it with a .vbs extension
ie  ShowHide.vbs

Windows 2000 and XP

Dim WSHShell, n, p, itemtype
Set WSHShell = WScript.CreateObject("WScript.Shell")
p = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDesktop"
itemtype = "REG_DWORD"
n = WSHShell.RegRead (p)
If n = 0 Then
WshShell.RegWrite p, 1, itemtype
End If
If n = 1 Then 
WshShell.Regwrite p, 0, itemtype
End If
Set WshShell = Nothing
For Each Process in GetObject("winmgmts:"). _
ExecQuery ("select * from Win32_Process where name='explorer.exe'")
Process.terminate(0)
Next



Windows 98/Me

Dim WSHShell, n, p, itemtype
Set WSHShell = WScript.CreateObject("WScript.Shell")
p = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDesktop"
itemtype = "REG_DWORD"
n = WSHShell.RegRead (p)
If n = 0 Then
WshShell.RegWrite p, 1, itemtype
End If
If n = 1 Then 
WshShell.Regwrite p, 0, itemtype
End If
CreateObject("Wscript.Shell").Run "rundll32.exe shell32.dll,SHExitWindowsEx 0",0


Now you have one file that when double clicked will hide the desktop if it 
isn't already hidden or show the desktop if it is hidden (like a toggle switch)

Windows 95

For 95, simply replace the command line in the 98/Me code ("rundll32.exe 
shell32.dll,SHExitWindowsEx 0",0) with this:
rundll.exe user.exe,exitwindowsexec
which restarts Windows 95 after the reg change is made.

vic

*****

Correction Notice - in the last issue on AutoComplete Web Passwords, I made an 
error. The section  on "FormSuggest PW Ask" had the yes and no values reversed.
It should have read like this:

When you check the box, you are setting it to NO:
"FormSuggest PW Ask"="no"
and you will never be prompted to save your password ever.

If you uncheck the box, you are setting the value to YES
"FormSuggest PW Ask"="yes"

sorry for the mixup.


Have feedback, a question or tip you would like to have considered for 
submission?  Send it to:
regtips@xxxxxxxxxx?Subject=feedback


For other Windows tips, you may also want to subscribe to the Wintips&Tricks 
newsletter.
More info here:
http://www.angelfire.com/va3/wintips/

If you are new to registry editing and find all this confusing, then I suggest 
Registry for Newbies 
which is the best newbie ebook for learning the registry from ground up in 
plain english
http://newbieclub.com/rfncopy/?vic

Recommended Computer Magazines
http://www.angelfire.com/va3/wintips/pcmags.html

If this was forwarded to you and you would like to subscribe to Registry 
Answers, click here and hit Send
regtips-request@xxxxxxxxxxxxx?Subject=subscribe

To unsubscribe, click here and hit Send
regtips-request@xxxxxxxxxxxxx?Subject=unsubscribe


Other related posts:

  • » Hide or Show Desktop