troubleshooting Question

Refreshing desktop after deleting a shortcut from it

Avatar of Stef Merlijn
Stef MerlijnFlag for Netherlands asked on
3 Comments1 Solution303 ViewsLast Modified:

After I delete a shortcut from my desktop (programmatically) the desktop should refresh.
I've tried a lot of possibilities (see below) found on EE but none of them worked...

Solution 1:

Solution 2:
RedrawWindow(GetDesktopWindow(), nil, 0, RDW_INVALIDATE or RDW_UPDATENOW or RDW_ALLCHILDREN);

Solution 3:
procedure RefreshDesktop;
var c1 : cardinal;
  c1:=FindWindowEx(FindWindowEx(FindWindow('Progman','Program Manager'),0,'SHELLDLL_DefView',''),0,'SysListView32','');
  PostMessage(c1,WM_KEYDOWN,VK_F5,0); PostMessage(c1,WM_KEYUP,VK_F5,1 shl 31);

Solution 4:
SendMessage(FindWindow('Progman', 'Program Manager'), WM_COMMAND, 106597,0);

Solution 5:
SendMessage(FindWindow('Progman', 'Program Manager'), WM_COMMAND, $A065, 0);

Solution 6:
winexec(PChar('rundll32 user,repaintscreen'),0);

Can anybody give me a working solution?

Thanks a lot for your help,
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros