Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using vbscript to refresh desktop

Status
Not open for further replies.

kweh4

Technical User
Aug 8, 2001
33
US
I have a script that delete couples of icons of the desktop and places new icon on the desktop. Howeve, the deleted icons stays on the desktop until the user refreshes the screen. I want to add a line of code to the script that will refresh the desktop for the user. Please held.

MCSE 2000
Computer Engineering Technology
 
Use sendkeys to send the F5 command.


This script recreates the special Outlook desktop icon. I use the code in here. Take a look.

Code:
on error resume next

Dim path

Set WSHShell = CreateObject("WScript.Shell")

path = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{00020D75-0000-0000-C000-000000000046}\"
WSHShell.RegWrite path & "Removaltext","This is a special icon, do not delete","REG_SZ"
WshShell.AppActivate "Program Manager"
WshShell.SendKeys "{F5}"
If err then
	msgbox "Error Encountered" & Err.Description
else
	msgbox "Outlook Creation Sucessful"
End if

I hope you find this post helpful.

Regards,

Mark
 
Thanks Mark, I did find it helpful.

MCSE 2000
Computer Engineering Technology
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top