WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: mcjathan on February 13, 2014, 08:10:59 AM

Title: Refresh Desktop?
Post by: mcjathan on February 13, 2014, 08:10:59 AM
Greetings,

I'm looking for some guidance.  I need to be able to refresh my desktop (WinXP & Win7) at times using Winbatch.  With a mouse, you simply right-click on the desktop and choose "Refresh".  How can I do this using Winbatch?

I found this in the Winbatch tech support database:

    http://tinyurl.com/mo5nd3z

However, it looks like this Winbatch tech support file was last updated in 2001.  Is there a better way to refresh the desktop than is shown in this article?

Regards,

Jeff
Title: Re: Refresh Desktop?
Post by: Deana on February 13, 2014, 08:43:43 AM
Maybe give this code a try:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/DllCall~Information+Refresh~Everything~By~Telling~Windows~an~Association~has~Changed.txt

Reference
API :http://msdn.microsoft.com/en-us/library/windows/desktop/bb762118(v=vs.85).aspx
MSDN Thread: http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/f9450610-5d0d-40bd-b9f8-d086f39042bc/refresh-desktop-icon-via-shchangenotify-on-windows-8
Title: Re: Refresh Desktop?
Post by: td on February 13, 2014, 08:49:03 AM
Not sure what you are looking for in a better way but the shell API function mentioned in the article is still part of the Windows shell so the article's technique should still work as well on Windows 8.1 as it did on NT 4.0.

Another possible technique would be to use the WinBatch/WIL WallPaper function specifying your current desktop wall paper. The WallPaper function calls an underlying shell COM interface method to do the equivalent of f5 on the desktop.  I haven't tried this approach so I can't guarantee that it will work but I can't think of a reason why it wouldn't either.
Title: Re: Refresh Desktop?
Post by: td on February 13, 2014, 09:18:15 AM
No guarantees of success but here's the one liner
Code (winbatch) Select

WallPaper(SysParamInfo(115,0,0),0)
Title: Re: Refresh Desktop?
Post by: mcjathan on February 17, 2014, 09:41:25 AM
Thank you, Deanna & td.

You're link to the Winbatch sample code works perfectly for me!

Regards,

Jeff