如何刷新Windows资源管理器 [英] How to refresh Windows Explorer

查看:1742
本文介绍了如何刷新Windows资源管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

>

可以更改卷的名称。

我将名称更改为脊髓磁盘

A network volume's name can be changed.
I changed the name to Spinal Disk

要更改网络名称,请执行

To change a network name, I do


  • 在注册表中写入新名称。

  • 使用像DefineDosDeviceW这样的功能附加我的网络卷。在这个时间,Windows资源管理器读取我的猜测注册表。

  • SHChangeNotify(SHCNE_DRIVEADD,SHCNF_PATH,root,NULL); //确定。

  • SendMessageTimeout(HWND_BROADCAST,WM_DEVICECHANGE,message,(LPARAM)(& dbv), - SMTO_ABORTIFHUNG,200,&dwResult); //

  • Write new name in Registry.
  • Attach my network volume using functions like DefineDosDeviceW. In this timing, Windows explorer read registry in my guessing.
  • SHChangeNotify(SHCNE_DRIVEADD, SHCNF_PATH, root, NULL); // To be sure.
  • SendMessageTimeout(HWND_BROADCAST, WM_DEVICECHANGE, message, (LPARAM)(&dbv), - SMTO_ABORTIFHUNG, 200, &dwResult); // To be sure again!

它可以工作,但有时候不工作,即使我使用SHChangeNotify和WM_DEVICECHANGE确定。有时,新名称不会应用于Windows资源管理器中。

但是如果我终止Explorer并重新执行,则应用的名称。

It works, but sometimes doesn't work even though I use SHChangeNotify and WM_DEVICECHANGE to be sure. Sometimes, the new name is not applied in Windows Explorer.
But if I terminate Explorer and re-execute, the name applied.

我找到一个有Windows资源管理器刷新的界面(是正确的语法吗?对不起,我不能很好地表达这句话。)

是否有适当的功能?资源管理器应重新读取注册表并刷新。

I'm finding an interface having Windows Explorer refreshed.(Is it correct syntax? Sorry, I can't express this sentence well.)
Is there a proper function? Explorer should re-read registry and be refreshed.

推荐答案

不幸的是,Explorer每次都不能刷新。因为太多的应用程序表现不佳,并且总是使用SHCNE_ALLEVENTS的SHChangeNotify()。想象一下,如果资源管理器每次收到该通知时总是刷新一遍(是的,有时每秒多次!)。

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.

但是这里是如何欺骗资源管理器:
从下往上发送多个路径的通知。通常足以首先发送例如 N:\folder ,然后 N:\ 才能真正刷新 \\

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:\.

您应该先发送WM_DEVICECHANGE消息,然后调用SHChangeNotify()。

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

这篇关于如何刷新Windows资源管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆