How to refresh Windows Explorer

前端 未结 2 1910
梦如初夏
梦如初夏 2020-12-19 11:51

\"enter

A network volume\'s name can be changed.
I changed the name to Spina

相关标签:
2条回答
  • 2020-12-19 12:17

    Unfortunately, Explorer simply can't refresh every time it is told so. Because way too many apps behave badly and always use SHChangeNotify() with SHCNE_ALLEVENTS. Imagine if the explorer would really always refreshed 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, and only then call SHChangeNotify().

    0 讨论(0)
  • 2020-12-19 12:36

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

    0 讨论(0)
提交回复
热议问题