Enable/disable "Show desktop icon"

G

Guest

Hi all,
a customer of mine is more interested in deskop icon than my 100MB,
Real-Time application and wants to enable "show desktop icon" flag
programmatically.
I checked in the net and found to set in
HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
a value "NoDesktop" and then reboot. I tried it but it does not work neither
in XPE nor in my XP SP2 machine. Something must be changed. I checked with
sysinternals'Regmon but it seems that Windows does not change any value when
I enable the feature via UI. Can anyone help me?
Thanks a lot.
Andrea
 
S

Sean Liming \(eMVP\)

The registry key is correct. Enable = 0 and Disable = 1. You have to log out
of the account and log back in for the change to take effect.

Regards,

Sean Liming
www.sjjmicro.com / www.seanliming.com
XP Embedded Book Author - XP Embedded Advanced, XP Embedded Supplemental
Toolkit
 
G

Guest

This is a script that attempts to change the "show deskop icon": it does not
work in my machine and in my XPE image:
So what?

'Enable or Disable Desktop Icons

Message = "To work correctly, the script will close" & vbCR
Message = Message & "and restart the Windows Explorer shell." & vbCR
Message = Message & "This will not harm your system." & vbCR & vbCR
Message = Message & "Continue?"

X = MsgBox(Message, vbYesNo, "Notice")

If X = 6 Then

On Error Resume Next

Dim WSHShell, n, MyBox, p, t, errnum, vers
Dim itemtype
Dim enab, disab, jobfunc

Set WSHShell = WScript.CreateObject("WScript.Shell")
p =
"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDesktop"

itemtype = "REG_DWORD"

enab = "ENABLED"
disab = "DISABLED"
jobfunc = "Desktop Icons are now "

t = "Confirmation"
Err.Clear
n = WSHShell.RegRead (p)
errnum = Err.Number

if errnum <> 0 then

WSHShell.RegWrite p, 0, itemtype
End If


If n = 0 Then
n = 1
WSHShell.RegWrite p, n, itemtype
Mybox = MsgBox(jobfunc & disab & vbCR, 4096, t)
ElseIf n = 1 then
n = 0
WSHShell.RegWrite p, n, itemtype
Mybox = MsgBox(jobfunc & enab & vbCR, 4096, t)
End If


Set WshShell = Nothing

On Error GoTo 0

For Each Process in GetObject("winmgmts:"). _
ExecQuery ("select * from Win32_Process where name='explorer.exe'")
Process.terminate(0)
Next

MsgBox "Finished." & vbcr & vbcr , 4096, "Done"

Else

MsgBox "No changes were made to your system." & vbcr & vbcr, 4096, "User
Cancelled"

End If
 
G

Guest

Some more info: it seems the problem is for the "Active Desktop". The script
does not work because the registry value does not take any effect on it.
Could you please suggest me a way out this problem??
 
S

Sean Liming \(eMVP\)

Active Desktop - soundsl like IE 4 stuff - do you mean a desktop with a
webpage enabled? If so the registery key still works, but the web access is
also hidden.

Regards,

Sean Liming
www.sjjmicro.com / www.seanliming.com
XP Embedded Book Author - XP Embedded Advanced, XP Embedded Supplemental
Toolkit
 
G

Guest

Sean,
could you pls run the script I sent to in a XP SP2 machine and see the
result? I used it in all my office machines and it did not work. Whatever is
the cause, Active Desktop or not (I am not using any feature of the active
desktop but I cannot remove from the XPe image), it seems to me something
changed in XP/XPe that prevents the script from working!!!
Could you pls help me?
Many thanks.
Andrea
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top