Win C#: Refresh Windows Explorer in Win7
Posted
by Paja
on Stack Overflow
See other posts from Stack Overflow
or by Paja
Published on 2010-03-21T21:09:08Z
Indexed on
2010/03/21
21:11 UTC
Read the original article
Hit count: 495
Hello,
My program sets "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" value "Hidden". Hovewer I'm not able to refresh the explorer to take into account this change. I've tried:
1) SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero); 2) SHELLSTATE state = new SHELLSTATE(); state.fShowAllObjects = (uint)1; SHGetSetSettings(ref state, SSF.SSF_SHOWALLOBJECTS, true); 3) SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETNONCLIENTMETRICS, 0, SMTO_ABORTIFHUNG, 5000, ref dwResult); 4) SendMessage(HWND_BROADCAST, WM_COMMAND, 28931 /* Refresh */, 0);
Nothing works. So what should I do? If I refresh Explorer myself with F5, then it works. Hovewer I would like some elegant solution, so it would refresh the display everywhere, even in OpenFile/SaveFile dialogs, which are currently open.
I'm using C# .NET, Win7.
Thank you.
© Stack Overflow or respective owner