How to refresh Windows Explorer

旧城冷巷雨未停 提交于 2019-11-29 11:15:55

Unfortunately, Explorer simply can't refresh every time it is told so. Because way too many apps behave badly, and just always use SHChangeNotify() with SHCNE_ALLEVENTS. Imagine if the explorer would really always refresh everything every time it receives that notification (yes, sometimes several times per second!).

That's why it sometimes doesn't work.

But here's how you can 'trick' the explorer: Send a notification for more than one path, from the bottom up. Usually it's enough to first send a notification for e.g. N:\folder and then for N:\ to really refresh N:\.

And you should send the WM_DEVICECHANGE message first, then call SHChangeNotify().

Use SHChangeNotify(). Not actually sure which wEventId you'd use in this particular case. Start with SHCNE_ALLEVENTS.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!