How to Refresh Desktop
Keywords: Refresh Desktop
Question:
I'm running NT40 with Option Pack 1 (Active Desktop)Has anyone figured out how to "Refresh" the desktop from WinBatch? (This is the right click on the desktop, selecting option "Refresh" from the context menu.)
Answer:
Try something like...mydir = ShortCutDir("Desktop") bb=BinaryAlloc(2048) BinaryPokeStr(bb,0,mydir) dllfile=strcat(dirwindows(1),"shell32.dll") DllCall(dllfile, void:"SHChangeNotify", long:4096, long:1, lpbinary:bb, lpbinary:bb) BinaryFree(bb)OR
If the previous code doesn't work try something like..
mydir =ShortCutDir("Desktop") SHCNE_ASSOCCHANGED=134217728 SHCNF_FLUSH=4096 dllfile=strcat(dirwindows(1),"shell32.dll") DllCall(dllfile, void:"SHChangeNotify", long:SHCNE_ASSOCCHANGED, long:SHCNF_FLUSH,lpnull, lpnull)and to do an Explorer refresh of "My Documents". (You can see if you go into your registry, and look at @regcurrent, "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal" note that Personal points to "My Documents".)mydir = ShortCutDir("Personal") bb=BinaryAlloc(2048) BinaryPokeStr(bb,0,mydir) dllfile=strcat(dirwindows(1),"shell32.dll") DllCall(dllfile, void:"SHChangeNotify", long:4096, long:1, lpbinary:bb, lpbinary:bb) BinaryFree(bb)
Article ID: W13177Filename: Refresh Desktop.txt