How to update Windows Explorer

enter image description here

You can change the name of the network volume.
I changed the name to the spinal disc
enter image description here

enter image description here

To change the network name, I do

  • Enter a new name in the registry.
  • Attach my network volume using functions such as DefineDosDeviceW. In this case, Windows Explorer reads the registry in my guesses.
  • SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL); // Of course.
  • SendMessageTimeout (HWND_BROADCAST, WM_DEVICECHANGE, message, (LPARAM) (& dbv), - SMTO_ABORTIFHUNG, 200, & dwResult); // Come back again!

It works, but sometimes it does not work, although I use SHChangeNotify and WM_DEVICECHANGE. Sometimes a new name is not used in Windows Explorer.
But if I exit Explorer and re-execute, the name is applied.

I found an interface with updating Windows Explorer (is this the correct syntax? Sorry, I cannot express this sentence well).
Is there a proper function? Explorer must re-read the registry and update.

+4
source share
2 answers

Unfortunately, Explorer simply cannot be updated every time it is told about it. Since too many applications behave badly, always use SHChangeNotify () with SHCNE_ALLEVENTS. Imagine if Explorer really always updated everything every time it received this notification (yes, sometimes several times per second!).

That is why it sometimes does not work.

But here's how you can β€œtrick” the conductor: Send a notification to more than one way, from bottom to top. Usually this is enough to first send a notification, for example. N:\folder , and then for N:\ to really update N:\ .

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

+3
source

Use SHChangeNotify (). Not really sure which WEventId you will use in this particular case. Start with SHCNE_ALLEVENTS.

+3
source

Source: https://habr.com/ru/post/1338966/


All Articles